Prompt:
override fun bar(o: Int?) { }
}

abstract class F : Java2<Int>   // Kotlin ← Java1 ←Java2

abstract class G : Java4<Int>   // Kotlin ← Java ← Kotlin ← Java

class H : Java4<Int> {  // Kotlin ← Java ← Kotlin ← Java with explicit override

Response:
override fun foo(): Int {
        return 1
    }

    override fun bar(o: Int?) { }
}

interface KotlinInterface<T> : Java3<T>

fun test(b: B, c: C, d: D, e: E, f: F, g: G, h: H) {
    var k: Int = b.a<|endoftext|>


Prompt:
fun baz(): String = "baz"
}
data class StableClassWithEquals(val value: Int)

fun referencingMemberFunctionFoo(sfh: StableFunctionsHolder): String = run(sfh::foo)
fun referencingMemberFunctionBar(sfh: StableFunctionsHolder): String = run(sfh::bar)

Response:
fun referencingMemberFunctionBaz(sfh: StableFunctionsHolder): String = run(sfh::baz)
fun referencingAnyEquals(any: Any): String = if ((Any::equals)(any, any)) "OK" else "FAIL"<|endoftext|>


Prompt:
(if (true) None() else r) checkType { _<Option<T>>() }
        // Works correctly
        if (true) None() else r
    }
    else r
}

fun <T> bind2(r: Option<T>): Option<T> {
    return if (r is Some) {
        // Works correctly
        if (true) None<T>() else r
    }

Response:
else r
}

fun <T, R> bind3(r: Option<T>): Option<T> {
    return <!RETURN_TYPE_MISMATCH!>if (r is Some) {
        // Diagnoses an error correctly
        if (true) None<R>() else r
    }
    else r<!>
}<|endoftext|>


Prompt:
* ====================================================
 */

/*
 * rint(x)
 * Return x rounded to integral value according to the prevailing
 * rounding mode.
 * Method:
 *	Using floating addition.
 * Exception:
 *	Inexact flag raised if x not equal to rint(x).
 */

package kotlin.math.fdlibm

private val TWO52 = doubleArrayOf(

Response:
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
    -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
)

internal fun rint(_x: Double): Double {
    var x: Double = _x
    var i0: Int
    var j0: Int
    var sx: Int<|endoftext|>


Prompt:
val instance_WithFakeOverride_RemovedDefault_I = WithFakeOverride_RemovedDefault_I()
    val instance_WithFakeOverride_I_J_Default = WithFakeOverride_I_J_Default()
    val instance_WithFakeOverride_Default_J_I = WithFakeOverride_Default_J_I()
    val instance_WithFakeOverride_I_J_RemovedDefault = WithFakeOverride_I_J_RemovedDefault()

Response:
val instance_WithFakeOverride_RemovedDefault_J_I = WithFakeOverride_RemovedDefault_J_I()
    val instance_WithRealOverride_I_Default = WithRealOverride_I_Default()
    val instance_WithRealOverride_Default_I = WithRealOverride_Default_I()
    val instance_WithRealOverride_I_RemovedDefault = WithRealOverride_I_RemovedDefault()<|endoftext|>


Prompt:
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
        }

Response: if (!checkEqualsClassMultiFieldValueClassUnderlyingName(old, new)) result.add(ProtoBufClassKind.MULTI_FIELD_VALUE_CLASS_UNDERLYING_NAME_LIST)<|endoftext|>


Prompt:
CHECK_TYPE_WITH_EXACT to "$helpersPath/types/checkTypeWithExact.kt",
        INFERENCE_HELPERS to "$helpersPath/inference/inferenceUtils.kt"
    )

    override val directiveContainers: List<DirectivesContainer> =
        listOf(AdditionalFilesDirectives)

    @OptIn(ExperimentalStdlibApi::class)

Response:
override fun produceAdditionalFiles(globalDirectives: RegisteredDirectives, module: TestModule): List<TestFile> {
        return buildList {
            for ((directive, path) in directiveToFileMap) {
                if (directive in module.directives) {
                    add(File(path).toTestFile())
                }
            }
        }
    }
}<|endoftext|>


Prompt:
// WITH_STDLIB
// WITH_COROUTINES

import helpers.*
import kotlin.coroutines.*

fun builder(c: suspend () -> Unit) {
    c.startCoroutine(EmptyContinuation)
}

@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Int?)

interface IBar {
    suspend fun bar(): IC?
}

Response:
fun Int?.toResultString() =
    if (this == null) "OK" else "!!! $this"

class Test() : IBar {
    override suspend fun bar(): IC = IC(null)

    suspend fun test1(): String {
        val b: IBar = this
        return b.bar()!!.s.toResultString()
    }

    suspend fun test2(): String {<|endoftext|>


Prompt:
isEqual(test1(::foo1), 77) ?: return "Fail foo1"
            isEqual(test2(::foo2), 88) ?: return "Fail foo2"
            isEqual(test3 { foo3() }, "foo3 update") ?: return "Fail foo3"
        }
        7, 8 -> {

Response:
isEqual(test1(::foo1), 99) ?: return "Fail foo1"
            isEqual(test2(::foo2), 88) ?: return "Fail foo2"
            isEqual(test3 { foo3() }, "foo3 update") ?: return "Fail foo3"
        }
        9 -> {<|endoftext|>


Prompt:
qualifiedAccess: FirQualifiedAccessExpression,
        explicitReceiverExpression: IrExpression?,
    ): IrExpression {
        when (this) {
            is IrMemberAccessExpression<*> -> {
                val resolvedFirSymbol = qualifiedAccess.toResolvedCallableSymbol()
                if (resolvedFirSymbol?.dispatchReceiverType != null) {

Response:
val baseDispatchReceiver = qualifiedAccess.findIrDispatchReceiver(explicitReceiverExpression)
                    var firDispatchReceiver = qualifiedAccess.dispatchReceiver
                    if (firDispatchReceiver is FirPropertyAccessExpression && firDispatchReceiver.calleeReference is FirSuperReference) {
                        firDispatchReceiver = firDispatchReceiver.dispatchReceiver
                    }<|endoftext|>


Prompt:
return emitCmpExchange(callSite, transformArgsForVolatile(callSite, args), CmpExchangeMode.SWAP, resultSlot)
    }
    private fun FunctionGenerationContext.emitGetAndSet(callSite: IrCall, args: List<LLVMValueRef>, resultSlot: LLVMValueRef?): LLVMValueRef {

Response:
return emitAtomicRMW(callSite, transformArgsForVolatile(callSite, args), LLVMAtomicRMWBinOp.LLVMAtomicRMWBinOpXchg, resultSlot)
    }
    private fun FunctionGenerationContext.emitGetAndAdd(callSite: IrCall, args: List<LLVMValueRef>): LLVMValueRef {<|endoftext|>


Prompt:
MethodBridge.ReturnValue.WithError.Success -> llvm.int8(0) // false

                is MethodBridge.ReturnValue.WithError.ZeroForError -> {
                    if (returnType.successBridge == MethodBridge.ReturnValue.Instance.InitResult) {
                        // Release init receiver, as required by convention.
                        objcReleaseFromRunnableThreadState(param(0))
                    }

Response:
Zero(returnType.toLlvmRetType(generationState).llvmType).llvm
                }
            }

            ret(returnValue)
        }

        continuation != null -> kotlinExceptionHandler { exception ->
            // Callee haven't suspended, so it isn't going to call the completion. Call it here:
            callFromBridge(<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_PARAMETER
// MODULE: m1-common
// FILE: common.kt

<!EXPECT_ACTUAL_INCOMPATIBILITY{JVM}!>expect class Foo1<!>
<!EXPECT_ACTUAL_INCOMPATIBILITY{JVM}!>expect class Foo2<!>

expect fun foo2(): Int

Response:
<!EXPECT_ACTUAL_INCOMPATIBILITY{JVM}!>expect val s: String<!>

<!EXPECT_ACTUAL_INCOMPATIBILITY{JVM}!>expect open class Foo3<!>

// MODULE: m2-jvm()()(m1-common)

// FILE: jvm.kt<|endoftext|>


Prompt:
import org.jetbrains.kotlin.utils.addToStdlib.popLast

fun KtSourceElement.getChild(type: IElementType, index: Int = 0, depth: Int = -1, reverse: Boolean = false): KtSourceElement? =
    getChild(setOf(type), index, depth, reverse)

Response:
fun KtSourceElement.getChild(types: TokenSet, index: Int = 0, depth: Int = -1, reverse: Boolean = false): KtSourceElement? =
    getChild(types.types.toSet(), index, depth, reverse)<|endoftext|>


Prompt:
if (a3.size != 56) return "fail 3: ${a3.size}"
    check56(a3)

    val a4 = A4()
    if (a4.size != 56) return "fail 4: ${a4.size}"
    check56(a4)

    val sized: Sized = a4

Response:
if (sized.size != 56) return "fail 5: ${a4.size}"

    return "OK"
}<|endoftext|>


Prompt:
@file:OptIn(KtAnalysisApiInternals::class, KtAllowProhibitedAnalyzeFromWriteAction::class)

package org.jetbrains.kotlin.analysis.api.lifetime

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.ModificationTracker

Response:
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.persistentListOf
import org.jetbrains.kotlin.analysis.api.*
import kotlin.reflect.KClass

public class KtReadActionConfinementLifetimeToken(private val modificationTracker: ModificationTracker) : KtLifetimeToken() {<|endoftext|>


Prompt: <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!> { <!CANNOT_INFER_PARAMETER_TYPE!>x<!> -> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>+<!> 1}

Response:
bar { x: Int -> x + 1}
}<|endoftext|>


Prompt:
import a.<!CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON!>O<!>.*

fun testErroneusAllUnderImportFromObject() {
    <!UNRESOLVED_REFERENCE!>A<!>()
    <!UNRESOLVED_REFERENCE!>B<!>

Response:
<!UNRESOLVED_REFERENCE!>bar<!>()
}

// FILE: c.kt
package c

import a.S.prop
import a.S.o
import a.S.ext
import a.S.A
import a.S.genericFun
import a.S.ext as extRenamed

fun testImportFromObjectByName() {
    prop<|endoftext|>


Prompt:
import org.jetbrains.kotlin.backend.common.serialization.proto.FileSignature as ProtoFileSignature
import org.jetbrains.kotlin.backend.common.serialization.proto.IdSignature as ProtoIdSignature
import org.jetbrains.kotlin.backend.common.serialization.proto.LocalSignature as ProtoLocalSignature

Response:
class IdSignatureDeserializer(
    private val libraryFile: IrLibraryFile,
    private val fileSignature: FileSignature?,
    private val internationService: IrInterningService
) {

    private fun loadSignatureProto(index: Int): ProtoIdSignature {
        return libraryFile.signature(index)
    }

    private val signatureCache = HashMap<Int, IdSignature>()<|endoftext|>


Prompt:
package org.jetbrains.kotlin.abicmp.reports

import org.jetbrains.kotlin.abicmp.defects.*
import org.jetbrains.kotlin.abicmp.tag
import java.io.ByteArrayOutputStream
import java.io.PrintWriter

Response:
val MISSING_CLASS1_D = DefectType("jar.missingClass1", "Missing class in #1", CLASS_A, JAR_FILE1_A)
val MISSING_CLASS2_D = DefectType("jar.missingClass2", "Missing class in #2", CLASS_A, JAR_FILE2_A)

class JarReport(
    private val header: String,<|endoftext|>


Prompt:
internal expect fun ulongToFloat(value: Long): Float

@PublishedApi
internal expect fun floatToULong(value: Float): ULong

@PublishedApi
internal expect fun ulongToDouble(value: Long): Double

@PublishedApi
internal expect fun doubleToULong(value: Double): ULong

internal expect fun uintToString(value: Int): String

Response:
internal expect fun uintToString(value: Int, base: Int): String

internal expect fun ulongToString(value: Long): String

internal expect fun ulongToString(value: Long, base: Int): String<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.withFileAnalysisExceptionWrapping

@OptIn(AdapterForResolveProcessor::class)
class FirConstantEvaluationProcessor(
    session: FirSession,
    scopeSession: ScopeSession
) : FirTransformerBasedResolveProcessor(session, scopeSession, FirResolvePhase.CONSTANT_EVALUATION) {

Response:
override val transformer = FirConstantEvaluationTransformerAdapter(session)
}

@AdapterForResolveProcessor
class FirConstantEvaluationTransformerAdapter(session: FirSession) : FirTransformer<Any?>() {
    private val transformer = FirConstantEvaluationBodyResolveTransformer(session)<|endoftext|>


Prompt:
C2901, C2902, C2903, C2904, C2905, C2906, C2907, C2908, C2909, C2910,
    C2911, C2912, C2913, C2914, C2915, C2916, C2917, C2918, C2919, C2920,

Response:
C2921, C2922, C2923, C2924, C2925, C2926, C2927, C2928, C2929, C2930,
    C2931, C2932, C2933, C2934, C2935, C2936, C2937, C2938, C2939, C2940,<|endoftext|>


Prompt:
open var overflowX: String
    open var overflowY: String
    open var padding: String
    open var paddingBottom: String
    open var paddingLeft: String
    open var paddingRight: String
    open var paddingTop: String
    open var pageBreakAfter: String
    open var pageBreakBefore: String
    open var pageBreakInside: String
    open var perspective: String
    open var perspectiveOrigin: String

Response:
open var phonemes: String
    open var position: String
    open var quotes: String
    open var resize: String
    open var rest: String
    open var restAfter: String
    open var restBefore: String
    open var right: String
    open var tabSize: String
    open var tableLayout: String
    open var textAlign: String
    open var textAlignLast: String<|endoftext|>


Prompt:
//        "∮" to 8750,
//        "↺" to 8634,
//        "⦾" to 10686,
//        "⦻" to 10683,
//        "‾" to 8254,
//        "⧀" to 10688,
//        "Ō" to 332,
//        "ō" to 333,

Response:
//        "Ω" to 937,
//        "ω" to 969,
//        "Ο" to 927,
//        "ο" to 959,
//        "⦶" to 10678,
//        "⊖" to 8854,
//        "𝕆" to 120134,
//        "𝕠" to 120160,<|endoftext|>


Prompt:
* SPEC VERSION: 0.1-268
 * MAIN LINK: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 8
 * PRIMARY LINKS: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 9
 * overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 10
 * NUMBER: 1

Response:
* DESCRIPTION: A companion object of a classifier type named foo at its declaration site
 */

// FILE: Case1.kt
package testPackage

// TESTCASE NUMBER: 1

class Case1() {
    companion object foo {
        operator fun invoke() {}

        fun f() {<|endoftext|>


Prompt:
val mainLoopVariable: IrVariable,
        val mainLoopVariableIndex: Int,
        val loopVariableComponents: Map<Int, IrVariable>,
        val loopVariableComponentIndices: List<Int>
    )

    private class FindInitializerCallVisitor(private val mainLoopVariable: IrVariable?) : IrElementVisitorVoid {
        var initializerCall: IrCall? = null

Response:
override fun visitElement(element: IrElement) {
            element.acceptChildrenVoid(this)
        }

        override fun visitCall(expression: IrCall) {
            val candidateCall = when (expression.origin) {
                IrStatementOrigin.FOR_LOOP_NEXT -> expression
                is IrStatementOrigin.COMPONENT_N -><|endoftext|>


Prompt:
append(containingDeclarationForTypeParameter?.qualifiedNameString())
                }
            }
        }

        if (symbol is KtFunctionLikeSymbol && symbol.valueParameters.isNotEmpty()) {
            appendLine()
            withIndent {
                printCollection(symbol.valueParameters, separator = "\n") { typeParameter ->

Response:
val containingDeclarationForValueParameter = typeParameter.getContainingSymbol()
                    append(typeParameter.render(renderingOptions))
                    append(" from ")
                    append(containingDeclarationForValueParameter?.qualifiedNameString())
                }
            }
        }
    }
}<|endoftext|>


Prompt:
package org.jetbrains.kotlin.codegen

import com.intellij.openapi.util.Key
import org.jetbrains.kotlin.codegen.CalculatedCodeFragmentCodegenInfo.CalculatedParameter
import org.jetbrains.kotlin.codegen.CodeFragmentCodegenInfo.IParameter

Response:
import org.jetbrains.kotlin.codegen.binding.MutableClosure
import org.jetbrains.kotlin.codegen.context.*
import org.jetbrains.kotlin.codegen.context.LocalLookup.*
import org.jetbrains.kotlin.codegen.state.GenerationState<|endoftext|>


Prompt:
}

    override fun replaceSetter(newSetter: FirPropertyAccessor?) {
    }

    override fun replaceContextReceivers(newContextReceivers: List<FirContextReceiver>) {
        error("Body cannot be replaced for FirJavaValueParameter")
    }

    override fun replaceStatus(newStatus: FirDeclarationStatus) {

Response:
error("Status cannot be replaced for FirJavaValueParameter")
    }
}

@FirBuilderDsl
class FirJavaValueParameterBuilder {
    var source: KtSourceElement? = null
    lateinit var moduleData: FirModuleData
    var attributes: FirDeclarationAttributes = FirDeclarationAttributes()
    lateinit var returnTypeRef: FirTypeRef
    lateinit var name: Name<|endoftext|>


Prompt:
sourceSetsDependsOnRelation = sourceSetsDependsOnRelation,
        sourceSetBinaryLayout = sourceSetBinaryLayout,
        sourceSetCInteropMetadataDirectory = sourceSetCInteropMetadataDirectory,
        sourceSetModuleDependencies = sourceSetModuleDependencies,
        hostSpecificSourceSets = hostSpecificSourceSets,
        sourceSetNames = sourceSetNames,

Response:
isPublishedAsRoot = isPublishedAsRoot
    )
}

private fun File.withParentDirectoriesCreated(): File = apply { parentFile.mkdirs() }<|endoftext|>


Prompt:
compareFlags(typeAliasContext, typeAliasA, typeAliasB, TYPE_ALIAS_FLAGS)
        compareAnnotationLists(typeAliasContext, typeAliasA.annotations, typeAliasB.annotations)

        compareTypeParameterLists(typeAliasContext, typeAliasA.typeParameters, typeAliasB.typeParameters)

        compareEntities(
            containerContext = typeAliasContext,

Response:
entityA = typeAliasA.underlyingType,
            entityB = typeAliasB.underlyingType,
            entityKind = TypeKind.UNDERLYING,
            entitiesComparator = ::compareTypes
        )
        compareEntities(
            containerContext = typeAliasContext,
            entityA = typeAliasA.expandedType,
            entityB = typeAliasB.expandedType,<|endoftext|>


Prompt:
fun createInOtherFile(): A = A(10)

// FILE: b.kt

import a.*

fun here(): A = A(10)

fun box(): String {
    if (here() != createInOtherFile()) return "Fail equals"
    if (here().hashCode() != createInOtherFile().hashCode()) return "Fail hashCode"

Response:
if (here().toString() != createInOtherFile().toString()) return "Fail toString"
    return "OK"
}<|endoftext|>


Prompt:
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.name.SpecialNames
import org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.commonSuperType
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.util.OperatorNameConventions

Response:
import org.jetbrains.kotlin.utils.addToStdlib.runIf

class CallAndReferenceGenerator(
    private val c: Fir2IrComponents,
    private val visitor: Fir2IrVisitor,
    private val conversionScope: Fir2IrConversionScope,
) : Fir2IrComponents by c {

    private val adapterGenerator = AdapterGenerator(c, conversionScope)<|endoftext|>


Prompt:
// test.kt:37 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String

// EXPECTATIONS JVM_IR
// test.kt:35 box:
// test.kt:20 compute:
// test.kt:21 compute:

Response:
// test.kt:22 compute: y:int=42:int
// test.kt:23 compute: y:int=42:int, i:int=0:int
// test.kt:7 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int<|endoftext|>


Prompt:
KtFakeSourceElementKind.DesugaredDivAssign,
            KtFakeSourceElementKind.DesugaredRemAssign,
            KtFakeSourceElementKind.DesugaredPrefixDec,
            KtFakeSourceElementKind.DesugaredPrefixInc,
            KtFakeSourceElementKind.DesugaredPostfixDec,
            KtFakeSourceElementKind.DesugaredPostfixInc
        )

Response:
}

    fun report(debugFactory: DebugInfoDiagnosticFactory0, sourceElement: KtSourceElement?) {
        if (sourceElement == null || sourceElement.kind !in allowedKindsForDebugInfo) return

        // Lambda argument is always (?) duplicated by function literal
        // Block expression is always (?) duplicated by single block expression<|endoftext|>


Prompt:
js(<!JSCODE_CAN_NOT_VERIFY_JAVASCRIPT!>"var " + <!JSCODE_ARGUMENT_NON_CONST_EXPRESSION!>valFromClass<!> + " = 1;"<!>)
    }

    fun testValWithGetterThis() {

Response: js(<!JSCODE_CAN_NOT_VERIFY_JAVASCRIPT!>"var ${<!JSCODE_ARGUMENT_NON_CONST_EXPRESSION!>valWithGetter<!>} = 1;"<!>)<|endoftext|>


Prompt:
val unaryBuilder = JsAstProtoBuf.UnaryOperation.newBuilder()
        unaryBuilder.operand = serialize(x.arg)
        unaryBuilder.type = map(x.operator)
        unaryBuilder.postfix = postfix
        return unaryBuilder.build()
    }

    protected fun map(modifier: JsFunction.Modifier) = when (modifier) {

Response:
JsFunction.Modifier.STATIC -> JsAstProtoBuf.Function.Modifier.STATIC
        JsFunction.Modifier.SET -> JsAstProtoBuf.Function.Modifier.SET
        JsFunction.Modifier.GET -> JsAstProtoBuf.Function.Modifier.GET<|endoftext|>


Prompt:
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycle
import org.jetbrains.kotlin.gradle.plugin.KotlinProjectSetupCoroutine
import org.jetbrains.kotlin.gradle.plugin.await
import org.jetbrains.kotlin.gradle.plugin.sources.KotlinDependencyScope

Response:
import org.jetbrains.kotlin.gradle.plugin.sources.sourceSetDependencyConfigurationByScope
import org.jetbrains.kotlin.gradle.targets.metadata.dependsOnClosureWithInterCompilationDependencies
import org.jetbrains.kotlin.gradle.targets.metadata.getPublishedPlatformCompilations<|endoftext|>


Prompt:
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
import org.jetbrains.kotlin.metadata.deserialization.NameResolverImpl
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.serialization.deserialization.ClassDeserializer

Response:
import org.jetbrains.kotlin.serialization.deserialization.getClassId

sealed class FileWithMetadata {
    class Incompatible(val version: BinaryVersion) : FileWithMetadata()

    open class Compatible(val proto: ProtoBuf.PackageFragment, val version: BinaryVersion) : FileWithMetadata() {<|endoftext|>


Prompt:
public inline fun <R> CharSequence.foldRight(initial: R, operation: (Char, acc: R) -> R): R {
    var index = lastIndex
    var accumulator = initial
    while (index >= 0) {
        accumulator = operation(get(index--), accumulator)
    }
    return accumulator
}

/**

Response:
* Accumulates value starting with [initial] value and applying [operation] from right to left
 * to each character with its index in the original char sequence and current accumulator value.
 *
 * Returns the specified [initial] value if the char sequence is empty.
 *
 * @param [operation] function that takes the index of a character, the character itself
 * and current accumulator value, and calculates the next accumulator value.
 */<|endoftext|>


Prompt:
put(ErrorsJs.WRONG_JS_QUALIFIER, "Qualifier contains illegal characters")

        put(ErrorsJs.CANNOT_CHECK_FOR_EXTERNAL_INTERFACE, "Cannot check for external interface: {0}", RENDER_TYPE)

Response:
put(ErrorsJs.UNCHECKED_CAST_TO_EXTERNAL_INTERFACE, "Unchecked cast to external interface: {0} to {1}", RENDER_TYPE, RENDER_TYPE)
        put(ErrorsJs.EXTERNAL_INTERFACE_AS_REIFIED_TYPE_ARGUMENT, "Cannot pass external interface {0} for reified type parameter", RENDER_TYPE)<|endoftext|>


Prompt:
if (isEqualNullableUnboxedRight(A(0), A(1))) return "Fail 46"
    if (!isEqualNullableUnboxedRight(A(1), A(1))) return "Fail 47"
    if (isEqualNullableUnboxedLeft(A(0), null)) return "Fail 48"

Response:
if (isEqualNullableUnboxedRight(null, A(1))) return "Fail 49"

    if (isEqualNullableUnboxedRight(null, A(null))) return "Fail 50"
    if (isEqualNullableUnboxedLeft(A(null), null)) return "Fail 51"

    return "OK"
}<|endoftext|>


Prompt:
@JsName("CharCompanionObject")
internal  object CharCompanionObject {
    @JsName("MIN_VALUE")
    public const val MIN_VALUE: Char = '\u0000'

    @JsName("MAX_VALUE")
    public const val MAX_VALUE: Char = '\uFFFF'

    @JsName("MIN_HIGH_SURROGATE")

Response:
public const val MIN_HIGH_SURROGATE: Char = '\uD800'

    @JsName("MAX_HIGH_SURROGATE")
    public const val MAX_HIGH_SURROGATE: Char = '\uDBFF'

    @JsName("MIN_LOW_SURROGATE")<|endoftext|>


Prompt:
/* @(#)e_exp.c 1.6 04/04/22 */
/*
 * ====================================================
 * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * is preserved.
 * ====================================================
 */

/* __ieee754_exp(x)

Response:
* Returns the exponential of x.
 *
 * Method
 *   1. Argument reduction:
 *      Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658.
 *	Given x, find r and integer k such that
 *
 *               x = k*ln2 + r,  |r| <= 0.5*ln2.
 *<|endoftext|>


Prompt:
fooShort(<!ARGUMENT_TYPE_MISMATCH!>1 + 1<!>)

    fooInt(1 * 1)
    fooByte(<!ARGUMENT_TYPE_MISMATCH!>1 * 1<!>)
    fooLong(1 * 1)
    fooShort(<!ARGUMENT_TYPE_MISMATCH!>1 * 1<!>)

Response:
fooInt(1 / 1)
    fooByte(<!ARGUMENT_TYPE_MISMATCH!>1 / 1<!>)
    fooLong(1 / 1)
    fooShort(<!ARGUMENT_TYPE_MISMATCH!>1 / 1<!>)

    fooInt(1 % 1)<|endoftext|>


Prompt:
val parameter = capturedValueToParameter[valueDeclaration] ?: return null

            return IrGetValueImpl(startOffset, endOffset, parameter.type, parameter.symbol)
        }
    }

    sealed class OwnerForLoweredDeclaration(val isLocal: Boolean) {
        abstract fun addChild(declaration: IrDeclaration)
        abstract fun closestDeclarationParent(): IrDeclarationParent

Response:
// Usually, just move local functions to the nearest class or file.
        class DeclarationContainer(private val irDeclarationContainer: IrDeclarationContainer) : OwnerForLoweredDeclaration(false) {
            override fun addChild(declaration: IrDeclaration) = irDeclarationContainer.addChild(declaration)

            override fun closestDeclarationParent() = irDeclarationContainer
        }<|endoftext|>


Prompt:
val DOCUMENT_FRAGMENT_NODE: Short
        val NOTATION_NODE: Short
        val DOCUMENT_POSITION_DISCONNECTED: Short
        val DOCUMENT_POSITION_PRECEDING: Short
        val DOCUMENT_POSITION_FOLLOWING: Short
        val DOCUMENT_POSITION_CONTAINS: Short

Response:
val DOCUMENT_POSITION_CONTAINED_BY: Short
        val DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: Short
    }
}

public external abstract class SVGHatchElement : SVGElement {
    companion object {
        val ELEMENT_NODE: Short
        val ATTRIBUTE_NODE: Short
        val TEXT_NODE: Short<|endoftext|>


Prompt:
if (element11 !in 1L..<3L != !range0.contains(element11)) throw AssertionError()
    if (!(element11 in 1L..<3L) != !range0.contains(element11)) throw AssertionError()
    if (!(element11 !in 1L..<3L) != range0.contains(element11)) throw AssertionError()
}

Response:
fun testR0xE12() {
    // with possible local optimizations
    if (2.toByte() in 1L..<3L != range0.contains(2.toByte())) throw AssertionError()
    if (2.toByte() !in 1L..<3L != !range0.contains(2.toByte())) throw AssertionError()<|endoftext|>


Prompt:
// 1 LOCALVARIABLE y Z (.*) 5

// JVM_IR_TEMPLATES_WITH_INLINE_SCOPES
// 1 LOCALVARIABLE x\\2 I (.*) 6
// 1 LOCALVARIABLE y\\2 I (.*) 5
// 1 LOCALVARIABLE x\\4 J (.*) 7

Response:
// 1 LOCALVARIABLE y\\4 J (.*) 5
// 1 LOCALVARIABLE x\\6 F (.*) 6
// 1 LOCALVARIABLE y\\6 F (.*) 5
// 1 LOCALVARIABLE x\\8 D (.*) 7
// 1 LOCALVARIABLE y\\8 D (.*) 5<|endoftext|>


Prompt:
interfaces: Array<dynamic>?,
    suspendArity: Array<Int>?,
    associatedObjectKey: Number?,
    associatedObjects: dynamic
) {
    if (parent != null) {
        js("""
          ctor.prototype = Object.create(parent.prototype)
          ctor.prototype.constructor = ctor;
        """)
    }

Response:
val metadata = createMetadata(kind, name, defaultConstructor, associatedObjectKey, associatedObjects, suspendArity)
    ctor.`$metadata$` = metadata

    if (interfaces != null) {
        val receiver = if (metadata.iid != VOID) ctor else ctor.prototype
        receiver.`$imask$` = implement(interfaces)
    }
}<|endoftext|>


Prompt:
val arguments = argumentList.originalArgumentList?.arguments ?: return
                for (key in arguments) {
                    if (key !is FirWrappedArgumentExpression && argumentList.mapping[key]?.name.let { it != null && it != Annotations.ParameterNames.value}) {

Response:
reporter.reportOn(key.source, FirJvmErrors.POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION, context)
                    }
                }
            }
        }
    }
}<|endoftext|>


Prompt:
// PROPERTY_NOT_USED: p9
    inline var p9: Int
        get() = a + 90000
        set(v) {
            a = v + 900
        }

    // PROPERTY_NOT_READ_FROM: p10
    var p10: Int
        inline get() = a + 100000
        set(v) {
            a = v + 1000
        }

Response:
// PROPERTY_NOT_WRITTEN_TO: p11
    var p11: Int
        get() = a + 110000
        inline set(v) {
            a = v + 1100
        }

    // CHECK_FUNCTION_EXISTS: get_p12_s8ev3n$ TARGET_BACKENDS=JS<|endoftext|>


Prompt:
val x91 = <!DEBUG_INFO_EXPRESSION_TYPE("Foo<Bar<L>>")!>foo9(y)<!>

    val x100 = <!DEBUG_INFO_EXPRESSION_TYPE("Bar<L>")!>foo10(x, <!DEBUG_INFO_EXPRESSION_TYPE("Foo<Bar<L>>")!>Foo(Bar())<!>)<!>

Response: val x101 = <!DEBUG_INFO_EXPRESSION_TYPE("Bar<L>")!>foo10(y, <!DEBUG_INFO_EXPRESSION_TYPE("Foo<Bar<L>>")!>Foo(Bar())<!>)<!><|endoftext|>


Prompt:
val ContextFunctionTypeParams = "ContextFunctionTypeParams".baseId()
        val Deprecated = "Deprecated".baseId()
        val DeprecatedSinceKotlin = "DeprecatedSinceKotlin".baseId()
        val RequireKotlin = "RequireKotlin".internalId()

        val ConsistentCopyVisibility = "ConsistentCopyVisibility".baseId()

Response:
val ExposedCopyVisibility = "ExposedCopyVisibility".baseId()

        val HidesMembers = "HidesMembers".internalId()
        val DynamicExtension = "DynamicExtension".internalId()
        val IntrinsicConstEvaluation = "IntrinsicConstEvaluation".internalId()

        val Retention = "Retention".annotationId()<|endoftext|>


Prompt:
// FILE: 1.kt

package test

enum class MyEnum {
    K;

    //TODO: KT-4693
    inline fun <T> doSmth(a: T) : String {
        return a.toString() + K.name
    }
}

// FILE: 2.kt

import test.*

fun test1(): String {

Response:
return MyEnum.K.doSmth("O")
}

fun box(): String {
    val result = test1()
    if (result != "OK") return "fail1: ${result}"

    return "OK"
}<|endoftext|>


Prompt:
}

    val list3 = ArrayList<Int>()
    val range3 = MaxS..MaxS step 1
    for (i in range3) {
        list3.add(i)
        if (list3.size > 23) break
    }
    if (list3 != listOf<Int>(MaxS.toInt())) {

Response:
return "Wrong elements for MaxS..MaxS step 1: $list3"
    }

    val list4 = ArrayList<Long>()
    val range4 = MaxL..MaxL step 1
    for (i in range4) {
        list4.add(i)
        if (list4.size > 23) break
    }
    if (list4 != listOf<Long>(MaxL)) {<|endoftext|>


Prompt: val test_ini = <!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>i === ni<!> || <!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>ni === i<!> || <!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>i !== ni<!> ||

Response: <!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>ni !== i<!><|endoftext|>


Prompt:
writeMissingClasses(output, jarFileName1, missingClassNames1)
        writeMissingClasses(output, jarFileName2, missingClassNames2)
    }

    private fun writeMissingClasses(output: PrintWriter, name: String, missing: Collection<String>) {
        if (missing.isNotEmpty()) {

Response:
output.tag("p", "Classes missing in $name: <b>${missing.size}</b>")
            output.tag("ul") {
                for (className in missing) {
                    output.tag("li", className)
                }
            }
        }
    }
}<|endoftext|>


Prompt:
// JVM_ABI_K1_K2_DIFF: KT-63864
// WITH_STDLIB

import kotlin.test.*

val sb = StringBuilder()

@Suppress("NOTHING_TO_INLINE")
inline fun foo(body: () -> Unit) {
    sb.appendLine("hello1")
    body()
    sb.appendLine("hello4")
}

Response:
fun bar() {
    foo {
        sb.appendLine("hello2")
        sb.appendLine("hello3")
    }
}

fun box(): String {
    bar()

    assertEquals("""
        hello1
        hello2
        hello3
        hello4

    """.trimIndent(), sb.toString())
    return "OK"
}<|endoftext|>


Prompt:
expect fun Int.intFunction(): Int
expect fun Short.intFunction(): Int
expect fun Long.intFunction(): Int
expect fun String.intFunction(): Int
expect fun Planet.intFunction(): Int

expect val <T> T.propertyWithTypeParameter1: Int
expect val <T : Any?> T.propertyWithTypeParameter2: Int

Response:
expect val <T : CharSequence> T.propertyWithTypeParameter4: Int

expect fun <T> T.functionWithTypeParameter1()<|endoftext|>


Prompt:
fun indexOf(valueDeclaration: IrValueDeclaration) : Int {
        return contextVariablesToIndex.getOrElse(valueDeclaration) { -1 }
    }

    fun addressOf(index: Int): LLVMValueRef {
        return variables[index].address()
    }

    fun load(index: Int, resultSlot: LLVMValueRef?): LLVMValueRef {

Response:
return variables[index].load(resultSlot)
    }

    fun store(value: LLVMValueRef, index: Int) {
        variables[index].store(value)
    }
}

internal data class VariableDebugLocation(val localVariable: DILocalVariableRef, val location:DILocationRef?, val file:DIFileRef, val line:Int)<|endoftext|>


Prompt:
private fun reportUnexpectedDescriptor(descriptor: DeclarationDescriptor) {
        error("unexpected descriptor $descriptor")
    }

    open fun PropertyDescriptor.platformSpecificSuffix(): String? = null

    private val CallableDescriptor.isRealStatic: Boolean
        get() = dispatchReceiverParameter == null && containingDeclaration !is PackageFragmentDescriptor

Response:
override fun DeclarationDescriptor.asTypeParameterContainer(): DeclarationDescriptor =
        this

    override fun getContextReceiverTypes(function: FunctionDescriptor): List<KotlinType> =
        function.contextReceiverParameters.map { it.type }

    override fun getExtensionReceiverParameterType(function: FunctionDescriptor): KotlinType? =<|endoftext|>


Prompt:
@Test fun longArrayInit() {
        val arr = LongArray(2) { it.toLong() }

        assertEquals(2, arr.size)
        assertEquals(0.toLong(), arr[0])
        assertEquals(1.toLong(), arr[1])

        testExceptOn(TestPlatform.Js) {

Response:
assertFailsWith<RuntimeException> { LongArray(-1) { it.toLong() } }
        }
    }

    @Test fun floatArray() {
        val arr = FloatArray(2)

        val expected: Float = 0.0F
        assertEquals(arr.size, 2)
        assertEquals(expected, arr[0])
        assertEquals(expected, arr[1])<|endoftext|>


Prompt:
abstract fun replaceResolvedToCompanionObject(newResolvedToCompanionObject: Boolean)

    abstract fun replaceCanBeValue(newCanBeValue: Boolean)

    abstract fun replaceTypeArguments(newTypeArguments: List<FirTypeProjection>)

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

Response:
abstract fun <D> transformTypeArguments(transformer: FirTransformer<D>, data: D): FirResolvedQualifier
}<|endoftext|>


Prompt:
/*should be shadowed by member property with invoke*/
infix fun B.barC(i: Int) = {}
/*should be shadowed by member property*/
val B.barC: C
get() = TODO()

fun case2() {
    class Case() {
        /*should be shadowed by member property*/
        val B.barC: C
        get() = TODO()

Response:
/*should be shadowed by member property with invoke*/
        infix fun B.barC(i: Int) = {}
        /*should be shadowed by member function*/
        infix fun B.fooC(i: Int) = {}
        fun case() {
            val b = B()<|endoftext|>


Prompt:
fun case_16(value_1: Int, value_2: Class, value_3: Class?, value_4: Int) {
    fun __fun_1(): () -> Unit { return fun() { } }

    when {
        value_1 == 1 -> funWithoutArgs()
        value_1 == 2 -> __fun_1()()
        value_1 == 3 -> value_2.fun_2(value_4)

Response:
value_1 == 4 -> value_3?.fun_2(value_4)
        value_1 == 5 -> value_3!!.fun_2(value_4)
    }
}

// TESTCASE NUMBER: 17
fun case_17(value_1: Int, value_2: Class, value_3: Class?) {
    when {<|endoftext|>


Prompt:
public Iterator<String> iterator() {
        return null;
    }

    @NotNull
    @Override
    public Object[] toArray() {
        return new Object[0];
    }

    @NotNull
    @Override
    public <T> T[] toArray(T[] a) {
        return null;
    }

    @Override
    public boolean add(String s) {

Response:
return false;
    }

    @Override
    public boolean remove(Object o) {
        return false;
    }

    @Override
    public boolean containsAll(Collection<?> c) {
        return false;
    }

    @Override
    public boolean addAll(Collection<? extends String> c) {
        return false;
    }

    @Override<|endoftext|>


Prompt:
<!SMARTCAST_IMPOSSIBLE!>x<!>.length // bad
}

fun testNoinline() {
    var x: String? = ""
    val lambda = noinline { x = null }
    x = ""
    lambda()
    <!SMARTCAST_IMPOSSIBLE!>x<!>.length // bad
}

fun testCrossinline() {

Response:
var x: String? = ""
    val lambda = crossinline { x = null }
    x = ""
    lambda()
    <!SMARTCAST_IMPOSSIBLE!>x<!>.length // bad
}<|endoftext|>


Prompt:
override fun invoke(receiver1: D, receiver2: E): V = get(receiver1, receiver2)

    class Getter<D, E, out V>(override val property: KProperty2Impl<D, E, V>) : KPropertyImpl.Getter<V>(), KProperty2.Getter<D, E, V> {

Response:
override fun invoke(receiver1: D, receiver2: E): V = property.get(receiver1, receiver2)
    }
}

internal class KMutableProperty2Impl<D, E, V> : KProperty2Impl<D, E, V>, KMutableProperty2<D, E, V> {<|endoftext|>


Prompt:
var accumulator: S = iterator.next()
            yield(accumulator)
            var index = 1
            while (iterator.hasNext()) {
                accumulator = operation(checkIndexOverflow(index++), accumulator, iterator.next())
                yield(accumulator)
            }
        }
    }
}

/**

Response:
* Returns a sequence containing successive accumulation values generated by applying [operation] from left to right
 * to each element and current accumulator value that starts with [initial] value.
 *
 * Note that `acc` value passed to [operation] function should not be mutated;
 * otherwise it would affect the previous value in resulting sequence.
 * The [initial] value should also be immutable (or should not be mutated)<|endoftext|>


Prompt:
mappingsBuilder.append(line)
    }

    fun generate() {
        val mappings = mappingsBuilder.build()

        FileWriter(outputFile).use { writer ->
            writer.writeHeader(outputFile, "kotlin.text")
            writer.appendLine()
            writer.appendLine("// ${mappings.size} mappings totally")

Response:
mappingsWriter.write(mappings, writer)
        }
    }

    companion object {
        fun forUppercase(outputFile: File, target: KotlinTarget, bmpUnicodeDataLines: List<UnicodeDataLine>): OneToManyMappingsGenerator {
            val builder = OneToManyUppercaseMappingsBuilder(bmpUnicodeDataLines)<|endoftext|>


Prompt:
substitutor: NewTypeSubstitutor,
        context: BasicCallResolutionContext,
    ): ReceiverExpressionKotlinCallArgument? {
        val newType = substitutor.safeSubstitute(type.unwrap())
        val receiverValue = when (this) {
            is ExpressionReceiver -> ExpressionReceiver.create(expression, newType, context.trace.bindingContext)

Response:
is ExtensionReceiver -> ExtensionReceiver(declarationDescriptor, newType, original)
            else -> return null
        }

        return ReceiverExpressionKotlinCallArgument(
            ReceiverValueWithSmartCastInfo(receiverValue, typesFromSmartCasts = emptySet(), true)
        )
    }
}<|endoftext|>


Prompt:
const val increment = <!EVALUATED: `4`!>inc(3)<!>
const val decrement = <!EVALUATED: `2`!>dec(3)<!>

const val unaryPlus = <!EVALUATED: `3`!>unaryPlus(3)<!>

Response:
const val unaryMinus = <!EVALUATED: `-3`!>unaryMinus(3)<!>

const val rangeTo1 = <!EVALUATED: `1`!>rangeTo(5, 1.toByte()).last<!>
const val rangeTo2 = <!EVALUATED: `2`!>rangeTo(5, 2.toShort()).last<!><|endoftext|>


Prompt:
package org.jetbrains.kotlin.fir.analysis.jvm.checkers.declaration

import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget

Response:
import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.diagnostics.reportOn
import org.jetbrains.kotlin.fir.FirSession<|endoftext|>


Prompt:
hierarchy.applyHierarchyTemplate(KotlinHierarchyTemplate.default, extension)
    }

    @ExperimentalKotlinGradlePluginApi
    override fun applyHierarchyTemplate(template: KotlinHierarchyTemplate) {
        hierarchy.applyHierarchyTemplate(template)
    }

    @ExperimentalKotlinGradlePluginApi

Response:
override fun applyHierarchyTemplate(template: KotlinHierarchyTemplate, extension: KotlinHierarchyBuilder.Root.() -> Unit) {
        hierarchy.applyHierarchyTemplate(template, extension)
    }

    @ExperimentalKotlinGradlePluginApi
    override fun applyHierarchyTemplate(template: KotlinHierarchyBuilder.Root.() -> Unit) {<|endoftext|>


Prompt:
.single { it.name == StandardNames.FqNames.mutableMap.shortName() }
                environment.javaClassToIrClass += nodeClass to mutableMap.declarations.filterIsInstance<IrClass>().single()
            }
            javaClass == LinkedHashMap::class.java -> {
                val entryClass = javaClass.declaredClasses.single { it.name.contains("\$Entry") }

Response:
val mutableMap = irClass.superTypes.mapNotNull { it.classOrNull?.owner }
                    .single { it.name == StandardNames.FqNames.mutableMap.shortName() }
                environment.javaClassToIrClass += entryClass to mutableMap.declarations.filterIsInstance<IrClass>().single()
            }<|endoftext|>


Prompt: fun <<!WRONG_ANNOTATION_TARGET!>@TA<!> @TPA(3) <!REPEATED_ANNOTATION!>@TPA<!> <!REPEATED_ANNOTATION, WRONG_ANNOTATION_TARGET!>@TA(<!TOO_MANY_ARGUMENTS!>12<!>)<!>

Response: <!REPEATED_ANNOTATION!>@TPA(<!TYPE_MISMATCH!>"Test"<!>)<!>  T> innerFun() = 12<|endoftext|>


Prompt:
class C(val i : Int) {
    operator fun component1() = i + 1
    operator fun component2() = i + 2
    operator fun rangeTo(c: C) = Range(this, c)
}

fun doTest(): String {
    var s = ""
    for ((a, _) in C(0)..C(2)) {
        s += "$a;"
    }

Response:
for ((_, b) in C(1)..C(3)) {
        s += "$b;"
    }

    for ((_, `_`) in C(2)..C(4)) {
        s += "$`_`;"
    }

    return s
}

fun box(): String {
    val s = doTest()<|endoftext|>


Prompt:
ProtoBuf.Effect.InvocationKind.AT_MOST_ONCE -> EventOccurrencesRange.AT_MOST_ONCE
            ProtoBuf.Effect.InvocationKind.EXACTLY_ONCE -> EventOccurrencesRange.EXACTLY_ONCE
            ProtoBuf.Effect.InvocationKind.AT_LEAST_ONCE -> EventOccurrencesRange.AT_LEAST_ONCE

Response:
}

        private fun extractType(proto: ProtoBuf.Expression): KotlinType? {
            return typeDeserializer.type(proto.isInstanceType(typeTable) ?: return null)
        }

        private fun deserializeConstant(value: ProtoBuf.Expression.ConstantValue): ConstantReference? = when (value) {<|endoftext|>


Prompt:
addExtensionReceiver(irBuiltIns.kClassClass.starProjectedType)
                returnType = javaLangClass.starProjectedType
            }
        }.symbol

    val kClassJavaPropertyGetter: IrSimpleFunction =
        kClassJava.owner.getter!!

Response:
val spreadBuilder: IrClassSymbol = createClass(FqName("kotlin.jvm.internal.SpreadBuilder")) { klass ->
        klass.addConstructor().apply {
            addValueParameter("size", irBuiltIns.intType)
        }

        klass.addFunction("addSpread", irBuiltIns.unitType).apply {
            addValueParameter("container", irBuiltIns.anyNType)<|endoftext|>


Prompt:
public val kotlin.Double.seconds: kotlin.time.Duration { get; }

@kotlin.SinceKotlin(version = "1.3")
@kotlin.time.ExperimentalTime

Response:
@kotlin.Deprecated(message = "Use 'Int.seconds' extension property from Duration.Companion instead.", replaceWith = kotlin.ReplaceWith(expression = "this.seconds", imports = {"kotlin.time.Duration.Companion.seconds"}))
@kotlin.DeprecatedSinceKotlin(errorSince = "1.8", hiddenSince = "1.9", warningSince = "1.5")<|endoftext|>


Prompt:
assertFailsWith<NoSuchElementException> { empty.maxOf { 0.0F } }

    }

    private inline fun <R> expectMinMaxOfWith(min: R, max: R, elements: UShortArray, comparator: Comparator<R>, selector: (UShort) -> R) {

Response:
assertEquals(min, elements.minOfWith(comparator, selector))
        assertEquals(min, elements.minOfWithOrNull(comparator, selector))
        assertEquals(max, elements.maxOfWith(comparator, selector))
        assertEquals(max, elements.maxOfWithOrNull(comparator, selector))
    }

    @Test<|endoftext|>


Prompt:
import org.jetbrains.kotlin.name.StandardClassIds
import org.jetbrains.kotlin.types.TypeApproximatorConfiguration

class FirWhenExhaustivenessTransformer(private val bodyResolveComponents: BodyResolveComponents) : FirTransformer<Any?>() {
    companion object {
        private val exhaustivenessCheckers = listOf(

Response:
WhenOnBooleanExhaustivenessChecker,
            WhenOnEnumExhaustivenessChecker,
            WhenOnSealedClassExhaustivenessChecker,
            WhenOnNothingExhaustivenessChecker
        )

        fun computeAllMissingCases(session: FirSession, whenExpression: FirWhenExpression): List<WhenMissingCase> {
            val subjectType =<|endoftext|>


Prompt:
return "OF_FINALLY1"
            }
    )

    return "LOCAL";
}

fun test2(h: Holder, doReturn: Int): String {
    doCall (
            {
                if (doReturn < 1) {
                    h.value += "OK_NONLOCAL"
                    return "OK_NONLOCAL"
                }
                h.value += "LOCAL"

Response:
"OK_LOCAL"
            },
            {
                try {
                    h.value += ", OF_FINALLY1"
                    return "OF_FINALLY1"
                } finally {
                    h.value += ", OF_FINALLY1_FINALLY"
                }
            }
    )

    return "FAIL";
}

fun box(): String {
    var h = Holder()<|endoftext|>


Prompt:
firDefaultVisitorType to ::VisitorPrinter.bind(true),
            firVisitorVoidType to ::VisitorVoidPrinter,
            firDefaultVisitorVoidType to ::DefaultVisitorVoidPrinter,
            firTransformerType to ::TransformerPrinter.bind(model.rootElement),
        ),
        ImplementationConfigurator,
        BuilderConfigurator,

Response:
::ImplementationPrinter,
        ::BuilderPrinter,
    )
}<|endoftext|>


Prompt:
return configurations.findResolvable(SWIFT_EXPORT_CLASSPATH_RESOLVABLE)
        ?: project.configurations.createResolvable(SWIFT_EXPORT_CLASSPATH_RESOLVABLE) {
            description = "Resolves the runtime classpath for the SwiftExport worker."

Response:
attributes.setAttribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
            attributes.setAttribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
            attributes.setAttribute(Usage.USAGE_ATTRIBUTE, usageByName(Usage.JAVA_RUNTIME))<|endoftext|>


Prompt:
if (insn.opcode == Opcodes.GETFIELD) {
            insn.fieldLoad()?.let { return it }
        }
        return super.unaryOperation(insn, value)
    }

    override fun merge(v: BasicValue?, w: BasicValue?): BasicValue? =

Response:
if (v is PossibleLambdaLoad && w is PossibleLambdaLoad && v.insn == w.insn) v else super.merge(v, w)
}<|endoftext|>


Prompt:
// WITH_REFLECT
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses
package test

import kotlin.reflect.KClass

OPTIONAL_JVM_INLINE_ANNOTATION
value class ICInt(val i: Int)

Response:
OPTIONAL_JVM_INLINE_ANNOTATION
value class ICIntArray(val i: IntArray)

OPTIONAL_JVM_INLINE_ANNOTATION
value class ICIntN(val i: Int?)

OPTIONAL_JVM_INLINE_ANNOTATION
value class ICIntNArray(val i: Array<Int?>)

OPTIONAL_JVM_INLINE_ANNOTATION<|endoftext|>


Prompt:
assert(!name.contains('.'))
            assert(!name.contains('`'))
            return Classifier(pkg, name)
        }
    }

    val isTopLevel: Boolean get() = this.nestedNames.isEmpty()

    fun nested(name: String): Classifier {
        assert(!name.contains('.'))
        assert(!name.contains('`'))

Response:
return this.copy(nestedNames = nestedNames + name)
    }

    fun getRelativeFqName(asSimpleName: Boolean = true): String = buildString {
        append(topLevelName.run { if (asSimpleName) asSimpleName() else this })
        nestedNames.forEach {
            append('.')<|endoftext|>


Prompt:
return PsiTreeUtil.findCommonParent(callElement, receiver.psiExpression) as? KtExpression? ?: callElement
    }

    override fun getExpectedTypeFromAsExpressionAndRecordItInTrace(resolvedAtom: ResolvedCallAtom): UnwrappedType? {

Response:
val candidateDescriptor = resolvedAtom.candidateDescriptor as? FunctionDescriptor ?: return null
        val call = (resolvedAtom.atom as? PSIKotlinCall)?.psiCall ?: return null

        if (call.typeArgumentList != null || !candidateDescriptor.isFunctionForExpectTypeFromCastFeature()) return null<|endoftext|>


Prompt:
import kotlin.math.min
import org.jetbrains.kotlin.backend.common.FileLoweringPass
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder
import org.jetbrains.kotlin.backend.common.pop

Response:
import org.jetbrains.kotlin.backend.common.push
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
import org.jetbrains.kotlin.backend.jvm.ir.isInlineClassType
import org.jetbrains.kotlin.builtins.StandardNames<|endoftext|>


Prompt:
if (s is IrDelegatingConstructorCall && s.symbol.owner.origin === PrimaryConstructorLowering.SYNTHETIC_PRIMARY_CONSTRUCTOR) {
                superCallIndex = i
            }
        }

        if (callIndex != -1 && superCallIndex != -1) {
            val tmp = statements[callIndex]

Response:
statements[callIndex] = statements[superCallIndex]
            statements[superCallIndex] = tmp
        }
    }
}<|endoftext|>


Prompt:
if (!(element19 in 3L until 1L) != !range1.contains(element19)) throw AssertionError()
    if (!(element19 !in 3L until 1L) != range1.contains(element19)) throw AssertionError()
}

fun testR1xE20() {
    // with possible local optimizations

Response:
if (4.toByte() in 3L until 1L != range1.contains(4.toByte())) throw AssertionError()
    if (4.toByte() !in 3L until 1L != !range1.contains(4.toByte())) throw AssertionError()<|endoftext|>


Prompt:
// WITH_STDLIB
import kotlin.test.*

interface I
class A() : I {}
class B() {}

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

fun isTypeOf(a: Any?) : Boolean {
  return a is A
}

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

fun isTypeNullableOf(a: Any?) : Boolean {
  return a is A?
}

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

Response:
fun isNotTypeOf(a: Any) : Boolean {
  return a !is A
}

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

fun isTypeOfInterface(a: Any) : Boolean {
  return a is I
}

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

fun box(): String {
  if (!isTypeOf(A())) return "FAIL !isTypeOf(A())"<|endoftext|>


Prompt:
val newOffset = offset
                            offset += type.size
                            LocalVariableNode(newVarName, type.descriptor, null, newStart, newEnd, newOffset)
                        }
                } else {
                    localVariableNode.desc = unboxedType.descriptor
                }
            }
        }
        return localVariablesReplacement
    }

    private fun getValuesStoredOrLoadedToVariable(

Response:
localVariableNode: LocalVariableNode,
        node: MethodNode,
        frames: Array<out Frame<BasicValue>?>
    ): List<BasicValue> {
        val values = ArrayList<BasicValue>()
        val insnList = node.instructions
        val localVariableStart = insnList.indexOf(localVariableNode.start)<|endoftext|>


Prompt:
// FIR_IDENTICAL
@file:JsModule("foo")
package foo

@JsModule("A")
external class <!NESTED_JS_MODULE_PROHIBITED!>A<!> {
    class Nested
}

@JsModule("B")
external <!NESTED_JS_MODULE_PROHIBITED!>object B<!>

Response:
<!NESTED_JS_MODULE_PROHIBITED!>@JsModule("foo")
external fun foo(): Int<!>

<!NESTED_JS_MODULE_PROHIBITED!>@JsModule("bar")
external val bar: Int<!><|endoftext|>


Prompt:
val daemonCompileOptions = compilationConfiguration.asDaemonCompilationOptions
        val exitCode = daemon.compile(
            sessionId,
            arguments.toTypedArray() + sources.map { it.absolutePath }, // TODO: pass the sources explicitly KT-62759
            daemonCompileOptions,
            BasicCompilerServicesWithResultsFacadeServer(loggerAdapter),
            DaemonCompilationResults(

Response:
loggerAdapter.kotlinLogger,
                compilationConfiguration.aggregatedIcConfiguration?.options?.rootProjectDir
            )
        ).get()

        try {
            daemon.releaseCompileSession(sessionId)
        } catch (e: RemoteException) {
            loggerAdapter.kotlinLogger.warn("Unable to release compile session, maybe daemon is already down: $e")<|endoftext|>


Prompt:
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
    fun Int.set3(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: Any<!>, b: Int, c: Any?)<!> {}

    @nativeSetter

Response:
fun Any.<!NATIVE_SETTER_WRONG_RETURN_TYPE!>foo<!>(<!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>a: Double = 0.0<!>, <!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>v: String? = null<!>) = "OK"
}<|endoftext|>


Prompt:
origin = SirOrigin.Unknown
                            kind = SirCallableKind.INSTANCE_METHOD
                            initKind = SirInitializerKind.CONVENIENCE
                            visibility = SirVisibility.PUBLIC
                            isFailable = false
                            parameters.addAll(
                                listOf(
                                    SirParameter(
                                        argumentName = "arg1",
                                        type = SirNominalType(SirSwiftModule.uint8)

Response:
),
                                    SirParameter(
                                        argumentName = "arg2",
                                        type = SirNominalType(SirSwiftModule.uint16)
                                    ),
                                    SirParameter(
                                        argumentName = "arg3",
                                        type = SirNominalType(SirSwiftModule.uint32)
                                    ),
                                    SirParameter(
                                        argumentName = "arg4",<|endoftext|>


Prompt:
data class Mapped(val bridge: TypeBridge) : MethodBridgeValueParameter()
    object ErrorOutParameter : MethodBridgeValueParameter()
    data class SuspendCompletion(val useUnitCompletion: Boolean) : MethodBridgeValueParameter()
}

@InternalKotlinNativeApi
data class MethodBridge(
    val returnBridge: ReturnValue,
    val receiver: MethodBridgeReceiver,

Response:
val valueParameters: List<MethodBridgeValueParameter>,
) {

    sealed class ReturnValue {
        object Void : ReturnValue()
        object HashCode : ReturnValue()
        data class Mapped(val bridge: TypeBridge) : ReturnValue()
        sealed class Instance : ReturnValue() {
            object InitResult : Instance()
            object FactoryResult : Instance()
        }<|endoftext|>


Prompt:
fun <T : DeclarationSymbolMarker> matchSingleExpectTopLevelDeclarationAgainstPotentialActuals(
        expectDeclaration: DeclarationSymbolMarker,
        actualDeclarations: List<DeclarationSymbolMarker>,
        context: ExpectActualMatchingContext<T>,
    ): DeclarationSymbolMarker? = with(context) {
        matchSingleExpectAgainstPotentialActuals(

Response:
expectDeclaration,
            actualDeclarations,
            substitutor = null,
            expectClassSymbol = null,
            actualClassSymbol = null,
            mismatchedMembers = null,
        ).singleOrNull()
    }

    fun matchClassifiers(
        expectClassSymbol: RegularClassSymbolMarker,
        actualClassLikeSymbol: ClassLikeSymbolMarker,<|endoftext|>


Prompt:
expectedType = expectedType
    )
}

fun LambdaWithTypeVariableAsExpectedTypeAtom.transformToResolvedLambda(
    csBuilder: ConstraintSystemBuilder,
    diagnosticsHolder: KotlinDiagnosticsHolder,
    expectedType: UnwrappedType? = null,
    returnTypeVariable: TypeVariableForLambdaReturnType? = null

Response:
): ResolvedLambdaAtom {
    val fixedExpectedType = (csBuilder.buildCurrentSubstitutor() as NewTypeSubstitutor)
        .safeSubstitute(expectedType ?: this.expectedType)
    val resolvedLambdaAtom = preprocessLambdaArgument(
        csBuilder,
        atom,
        fixedExpectedType,
        diagnosticsHolder,<|endoftext|>


Prompt:
package kotlin.script.experimental.util

interface LinkedSnippet<T> {
    val previous: LinkedSnippet<T>?
    fun get(): T
}

fun <T> LinkedSnippet<T>?.toList(): List<T> = toList { it }

Response:
fun <T, R> LinkedSnippet<T>?.toList(mapper: (T) -> R): List<R> {
    val res = ArrayList<R>()
    var el = this

    while (el != null) {
        res.add(mapper(el.get()))
        el = el.previous
    }

    res.reverse()
    return res
}<|endoftext|>


Prompt:
fun poll5(): Flow<String> {
    return flow {

Response: val inv = try { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!><!><|endoftext|>


Prompt:
// This is a placeholder that is transformed to a proper receiver for script class down below, but it is needed for
            // collecting captured script instances (see ClosureAnnotator.ClosureCollectorVisitor.processScriptCapturing)
            val type = IrSimpleTypeImpl(irScript.symbol, false, emptyList(), emptyList())

Response:
irScript.thisReceiver = irScript.createThisReceiverParameter(context, IrDeclarationOrigin.INSTANCE_RECEIVER, type)
        }

        val irScriptClass = irScript.targetClass!!.owner
        val typeRemapper = SimpleTypeRemapper(symbolRemapper)
        val capturingClasses = collectCapturingClasses(irScript, typeRemapper)<|endoftext|>


Prompt:
override val originalPsiProviderImpl: KtOriginalPsiProvider = KtFe10OriginalPsiProvider(this)
    override val inheritorsProviderImpl: KtInheritorsProvider = KtFe10InheritorsProvider(this)
    override val typesCreatorImpl: KtTypeCreator = KtFe10TypeCreator(this)

Response:
override val samResolverImpl: KtSamResolver = KtFe10SamResolver(this)
    override val importOptimizerImpl: KtImportOptimizer = KtFe10ImportOptimizer(this)
    override val jvmTypeMapperImpl: KtJvmTypeMapper = KtFe10JvmTypeMapper(this)<|endoftext|>


Prompt:
/**
 * Provides enumeration values to use to set regular expression options.
 */
public actual enum class RegexOption(override val value: Int, override val mask: Int = value) : FlagEnum {
    // common

    /** Enables case-insensitive matching. Case comparison is Unicode-aware. */
    IGNORE_CASE(Pattern.CASE_INSENSITIVE),

    /** Enables multiline mode.

Response:
*
     * In multiline mode the expressions `^` and `$` match just after or just before,
     * respectively, a line terminator or the end of the input sequence. */
    MULTILINE(Pattern.MULTILINE),

    //jvm-specific

    /** Enables literal parsing of the pattern.
     *<|endoftext|>


Prompt:
this.type = ProtoBuf.Annotation.Argument.Value.Type.BOOLEAN
                this.intValue = if (value) 1 else 0
            }
            is KmAnnotationArgument.UByteValue -> {
                this.type = ProtoBuf.Annotation.Argument.Value.Type.BYTE
                this.intValue = value.toLong()

Response:
this.flags = Flags.IS_UNSIGNED.toFlags(true)
            }
            is KmAnnotationArgument.UShortValue -> {
                this.type = ProtoBuf.Annotation.Argument.Value.Type.SHORT
                this.intValue = value.toLong()
                this.flags = Flags.IS_UNSIGNED.toFlags(true)
            }<|endoftext|>


Prompt:
&& irCallableReference.symbol is IrSimpleFunctionSymbol) { renderCompilerError(expression) }

                    val targetSymbol = irCallableReference.symbol
                    val target = targetSymbol.owner
                    val signatureTypes = target.allParameters.map { it.type } + target.returnType

                    function.typeParameters.indices.forEach { index ->

Response:
val typeArgument = expression.getTypeArgument(index)!!.toKotlinType()
                        val signatureType = signatureTypes[index].toKotlinType()

                        require(typeArgument.constructor == signatureType.constructor &&
                                typeArgument.isMarkedNullable == signatureType.isMarkedNullable) { renderCompilerError(expression) }
                    }<|endoftext|>


Prompt:
assertEquals(min, elements.minWith(comparator))
        assertEquals(max, elements.maxWith(comparator))
    }

    @Test
    fun minMaxWith() {""")
            for (size in 1..3) {
                val elements = defaultElements.take(size)

Response:
writer.appendLine("        expectMinMaxWith(${elements.first()}, ${elements.last()}, ${containerOf(elements)}, naturalOrder())")
            }
            if (isGeneric) {
                val elements = listOf("a", "B").map { "\"$it\"" }<|endoftext|>


Prompt:
WarningMode.All -> arguments.add("--warning-mode=all")
            WarningMode.Summary -> arguments.add("--warning-mode=summary")
            WarningMode.None -> arguments.add("--warning-mode=none")
        }

        if (configurationCache != null) {
            arguments.add("-Dorg.gradle.unsafe.configuration-cache=$configurationCache")

Response:
arguments.add("-Dorg.gradle.unsafe.configuration-cache-problems=${configurationCacheProblems.name.lowercase(Locale.getDefault())}")
        }

        if (gradleVersion >= GradleVersion.version("7.1")) {
            arguments.add("-Dorg.gradle.unsafe.isolated-projects=$projectIsolation")
        }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.resolve.toFirRegularClassSymbol
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol

Response:
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.name.CallableId<|endoftext|>


Prompt:
if (y != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit"), DEBUG_INFO_SMARTCAST!>this.y<!>.propAny
        if (y != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit & kotlin.Unit?")!>this.y<!>.propNullableT

Response:
if (y != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit & kotlin.Unit?")!>this.y<!>.propNullableAny
        if (y != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit"), DEBUG_INFO_SMARTCAST!>this.y<!>.funT()<|endoftext|>


Prompt:
// FIR_IDENTICAL
// NULLABILITY_ANNOTATIONS: @io.reactivex.rxjava3.annotations:strict

// FILE: A.java

import io.reactivex.rxjava3.annotations.*;

public class A<T> {
    @Nullable public String field = null;

    @Nullable

Response:
public String foo(@NonNull String x, @Nullable CharSequence y) {
        return "";
    }

    @NonNull
    public String bar() {
        return "";
    }

    @Nullable
    public T baz(@NonNull T x) { return x; }
}

// FILE: main.kt<|endoftext|>


Prompt:
setCause(null)  // TODO check this fact
        if (irClass.name.asString() != exception::class.java.simpleName) {
            // ir class wasn't found in classpath, a stub was passed => need to save java class hierarchy
            this.exceptionFqName = exception::class.java.name
            exceptionHierarchy += this.exceptionFqName

Response:
generateSequence(exception::class.java.superclass) { it.superclass }.forEach { exceptionHierarchy += it.name }
            exceptionHierarchy.removeAt(exceptionHierarchy.lastIndex) // remove unnecessary java.lang.Object
        }
    }

    fun copyFieldsFrom(wrapper: Wrapper) {
        (wrapper.value as? Throwable)?.let {<|endoftext|>


Prompt:
// as the type of this object may be any subtype of the parameter's type. All we know is that Function<N>
    // has to have a `invoke` that takes `Object`s and returns an `Object`; everything else needs to be figured
    // out from its contents. TODO: for > 22 arguments, the only argument is an array. `MethodInliner` can't do that.

Response:
val invokeName = if (isPropertyReference) OperatorNameConventions.GET.asString() else OperatorNameConventions.INVOKE.asString()
    val invokeNode = getMethodNode(classBytes, classType) {
        it.name == invokeName && it.returnType == AsmTypes.OBJECT_TYPE && it.argumentTypes.all { arg -> arg == AsmTypes.OBJECT_TYPE }<|endoftext|>


Prompt:
}

    val usedOuterCs: Boolean get() = system.usesOuterCs

    private var systemInitialized: Boolean = false
    val system: NewConstraintSystemImpl by lazy(LazyThreadSafetyMode.NONE) {
        val system = constraintSystemFactory.createConstraintSystem()

        val baseCSFromInferenceSession =

Response:
runUnless(baseSystem.usesOuterCs) { inferenceSession.baseConstraintStorageForCandidate(this) }
        if (baseCSFromInferenceSession != null) {
            system.setBaseSystem(baseCSFromInferenceSession)
            system.addOtherSystem(baseSystem)
        } else {
            system.setBaseSystem(baseSystem)
        }

        systemInitialized = true
        system<|endoftext|>


Prompt:
requireCapability("org.jetbrains.kotlin:kotlin-gradle-plugin-api-${variant.sourceSetName}")
                }
            }
        }
    }

    registerValidatePluginTasks(variantSourceSet)

    return variantSourceSet
}

/**
 * All additional configuration attributes in plugin variant should be the same as in the 'main' variant.

Response:
* Otherwise, Gradle <7.0 will fail to select plugin variant.
 */
private fun Project.commonVariantAttributes(): Action<Configuration> = Action<Configuration> {
    attributes {
        attribute(
            TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
            objects.named(TargetJvmEnvironment.STANDARD_JVM)
        )
    }
}<|endoftext|>


Prompt:
val two = Z(2)
    val four = Z(4)
    val seven = Z(7)

    assertEquals(seven, C::foo.call(one, 2, four))
    assertEquals(seven, (I)::bar.call(1, two, four))

Response:
val unboundFoo = C::class.members.single { it.name == "foo" } as KFunction<*>
    assertEquals(seven, unboundFoo.call(C, one, 2, four))

    val unboundBar = I.Companion::class.members.single { it.name == "bar" } as KFunction<*><|endoftext|>


Prompt:
"debug" -> NativeBuildType.DEBUG
                "release" -> NativeBuildType.RELEASE
                else -> null
            }

            return configuration.toNativeBuildType()
                ?: System.getenv("KOTLIN_FRAMEWORK_BUILD_TYPE")?.toNativeBuildType()
        }

    val targets: List<KonanTarget>
        get() {

Response:
val sdk = System.getenv("SDK_NAME") ?: return emptyList()
            val archs = System.getenv("ARCHS")?.split(" ") ?: return emptyList()
            return AppleSdk.defineNativeTargets(sdk, archs)
        }

    val frameworkSearchDir: File?
        get() {<|endoftext|>


Prompt:
// TARGET_BACKEND: WASM
// USE_NEW_EXCEPTION_HANDLING_PROPOSAL
// TODO: remove the test when KT-66906 will be resolved
// WITH_STDLIB
// WITH_COROUTINES

import helpers.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*

var globalResult = ""

Response:
var wasCalled = false
class Controller {
    val postponedActions = ArrayList<() -> Unit>()

    suspend fun suspendWithValue(v: String): String = suspendCoroutineUninterceptedOrReturn { x ->
        postponedActions.add {
            x.resume(v)
        }

        COROUTINE_SUSPENDED
    }<|endoftext|>


Prompt:
forEnumEntries = scopeForEnumEntries,
            primaryConstructorPureParametersScope = primaryConstructorPureParametersScope,
            primaryConstructorAllParametersScope = primaryConstructorAllParametersScope
        )

        return withTowerDataContexts(newContexts) {
            f()
        }
    }

    @OptIn(PrivateForInline::class)
    fun <T> withScript(

Response:
owner: FirScript,
        holder: SessionHolder,
        f: () -> T
    ): T {
        val towerElementsForScript = holder.collectTowerDataElementsForScript(owner)

        val base = towerDataContext.addNonLocalTowerDataElements(emptyList())
        val statics = base
            .addNonLocalScopeIfNotNull(towerElementsForScript.staticScope)<|endoftext|>


Prompt:
@OptIn(ExperimentalLibraryAbiReader::class)
    override fun execute() {
        val library = libraryInCurrentDir(args.libraryNameOrPath)

        if (!checkLibraryHasIr(library)) return

        val abiSignatureVersion = args.signatureVersion?.let { signatureVersion ->
            if (!signatureVersion.checkSupportedInLibrary(library)) return

Response:
val abiSignatureVersion = AbiSignatureVersion.resolveByVersionNumber(signatureVersion.number)
            if (!abiSignatureVersion.isSupportedByAbiReader) {
                output.logError(
                        "Signature version ${signatureVersion.number} is not supported by the KLIB ABI reader." +<|endoftext|>


Prompt:
val originalText = KtTestUtil.doLoadFile(File(filePath))!!
        val (text, carets) = extractCarets(originalText)

        setupLanguageVersionSettingsForCompilerTests(originalText, environment)

        val ktFile = KtPsiFactory(project).createFile(text)

Response:
val bindingContext = JvmResolveUtil.analyze(ktFile, environment).bindingContext

        val resolvedCallsAt = carets.map { caret -> caret to run {
            val (element, cachedCall) = buildCachedCallAtIndex(bindingContext, ktFile, caret)

            val resolvedCall = when {
                cachedCall !is VariableAsFunctionResolvedCall -> cachedCall<|endoftext|>


Prompt:
val arr = ByteArray(10) { 0 }
        assertEquals(0, arr.getIntAt(0))
        assertEquals(0, arr.getIntAt(6))
        assertFailsWith<IndexOutOfBoundsException> {
            arr.getIntAt(7)
        }
        assertFailsWith<IndexOutOfBoundsException> {
            arr.getIntAt(arr.size)

Response:
}
        assertFailsWith<IndexOutOfBoundsException> {
            arr.getIntAt(-1)
        }
        assertFailsWith<IndexOutOfBoundsException> {
            arr.getIntAt(Int.MAX_VALUE)
        }
        assertFailsWith<IndexOutOfBoundsException> {
            arr.getIntAt(Int.MIN_VALUE)
        }
    }<|endoftext|>


Prompt: // _Arrays.kt:... box: $i$f$foo\1\64:int=0:int, array\1:java.lang.Integer[]=java.lang.Integer[], myClass\1:MyClass=MyClass, $this$map\25:java.lang.Object[]=java.lang.Integer[], $i$f$map\25\459:int=0:int,

Response: $this$mapTo\26:java.lang.Object[]=java.lang.Integer[], destination\26:java.util.Collection=java.util.ArrayList, $i$f$mapTo\26\451:int=0:int<|endoftext|>


Prompt:
android.productFlavors.create("german").dimension = "market"
        android.productFlavors.create("usa").dimension = "market"
        android.productFlavors.create("paid").dimension = "price"
        android.productFlavors.create("free").dimension = "price"

        project.evaluate()

        fun assertKotlinSourceSetNameEquals(

Response:
androidSourceSetName: String, kotlinSourceSetName: String
        ) {
            val androidSourceSet = android.sourceSets.getByName(androidSourceSetName)
            val kotlinSourceSet = project.getKotlinSourceSetOrFail(androidSourceSet)
            assertEquals(
                kotlinSourceSetName, kotlinSourceSet.name,<|endoftext|>


Prompt:
"""
            @Composable
            fun Test() {
              A(a)
              A(b)
            }
        """
    )

    @Test
    fun testPrivateFunctionDoNotGetMarkedAsCall(): Unit = controlFlow(
        """
            @Composable
            private fun Test() {
              A(a)
              A(b)
            }
        """
    )

Response:
@Test
    fun testCallingAWrapperComposable(): Unit = controlFlow(
        """
            @Composable
            fun Test() {
              W {
                A()
              }
            }
        """
    )

    @Test
    fun testCallingAnInlineWrapperComposable(): Unit = controlFlow(
        """
            @Composable
            fun Test() {
              IW {<|endoftext|>


Prompt:
formatColumn(fullSet.getValue(name).second?.description ?: placeholder) +
                        formatColumn(change.first.description + " %") +
                        formatColumn(change.second.description))
            }
        } else {
            // Output all values without performance changes.
            for ((name, value) in fullSet) {
                append(formatColumn(name, true) +

Response:
formatColumn(value.first?.description ?: placeholder) +
                        formatColumn(value.second?.description ?: placeholder) +
                        formatColumn(placeholder) +
                        formatColumn(placeholder))
            }
        }
    }

    private fun printTableLineSeparator(tableWidth: Int) =
            append("${"-".padEnd(tableWidth, '-')}")<|endoftext|>


Prompt:
override fun getProgram(vararg statements: String): String {
        val sep = System.getProperty("line.separator")
        return statements.joinToString(sep) + sep
    }

    override fun getParameter(key: String?): Any? =
            when (key) {
                ScriptEngine.NAME -> engineName
                ScriptEngine.LANGUAGE -> languageName

Response:
ScriptEngine.LANGUAGE_VERSION -> languageVersion
                ScriptEngine.ENGINE -> engineName
                ScriptEngine.ENGINE_VERSION -> engineVersion
                else -> null
            }
}<|endoftext|>


Prompt:
fmodules = false, // with `-fmodules`, ld cannot find symbol `_assert`
            ).assertSuccess()
            val libFile = buildDir.resolve("$it.a")
            runProcess(llvmAr, "-rc", libFile.absolutePath, obj.absolutePath) {
                timeout = Duration.parse("1m")
            }
            assertTrue(libFile.exists())
        }

Response:
val defFile = buildDir.resolve("embedStaticLibraries.def").also {
            it.printWriter().use {
                it.println(
                    """
                    libraryPaths = ${buildDir.absolutePath.replace("\\", "/")}
                    staticLibraries = 3.a 4.a
                """.trimIndent()
                )
            }
        }<|endoftext|>


Prompt:
assertEquals("java.util.Date", java.util.Date::class.qualifiedName)
    assertEquals("kotlin.jvm.internal.Ref.ObjectRef", kotlin.jvm.internal.Ref.ObjectRef::class.qualifiedName)

    class Local
    assertEquals(null, Local::class.qualifiedName)

    val o = object {}

Response:
assertEquals(null, o.javaClass.kotlin.qualifiedName)

    return "OK"
}<|endoftext|>


Prompt:
compilationSpawner.spawn(emptyList()) {
            fun <T> copy(key: CompilerConfigurationKey<T>) = putIfNotNull(key, configuration.get(key))
            fun <T> copyNotNull(key: CompilerConfigurationKey<T>) = put(key, configuration.getNotNull(key))
            // For the first stage, use "-p library" produce mode.

Response:
put(KonanConfigKeys.PRODUCE, CompilerOutputKind.LIBRARY)
            copy(KonanConfigKeys.TARGET)
            put(KonanConfigKeys.OUTPUT, intermediateKLib.absolutePath)
            copyNotNull(CLIConfigurationKeys.CONTENT_ROOTS)
            copyNotNull(KonanConfigKeys.LIBRARY_FILES)<|endoftext|>


Prompt:
keptMethods.sortWith(compareBy(MethodNode::name, MethodNode::desc))
                                }

                                for (field in keptFields) {
                                    field.accept(cv)
                                }

                                for (method in keptMethods) {
                                    val mv = with(method) { cv.visitMethod(access, name, desc, signature, exceptions?.toTypedArray()) }

Response:
// Mapping the line numbers should only be done *after* sorting methods, as otherwise the order
                                    // of inline methods may be visible in their synthetic line numbers.
                                    method.accept(sourceMap?.let { SourceMapCopyingMethodVisitor(it, mv) } ?: mv)
                                }

                                val sourceMapText = sourceMap?.parent?.takeIf { !it.isTrivial }<|endoftext|>


Prompt:
val ktClass = resultingDescriptor.constructedClass.source.getPsi() as? KtClass
        if (ktClass?.isAnnotation() == true) return ktClass.fqName?.toString()
    }
    if (resultingDescriptor is JavaClassConstructorDescriptor) {

Response:
val psiClass = resultingDescriptor.constructedClass.source.getPsi() as? PsiClass
        if (psiClass?.isAnnotationType == true) return psiClass.qualifiedName
    }
    return null
}<|endoftext|>


Prompt:
}
}

fun box(): String {
    var result: Any = "FAIL1"
    builder {
        result = Test1().test()
    }
    c?.resume(IC("OK"))
    if (result != "OK") return "FAIL 1 $result"

    result = "FAIL2"
    builder {
        result = Test2().test()
    }

Response:
c?.resume("OK")
    if (result != "OK") return "FAIL 2 $result"

    result = "FAIL 3"
    builder {
        result = Test3().test()
    }
    c?.resume(IC("OK"))
    return result as String
}<|endoftext|>


Prompt:
if (isEqualAnyNullableRight<String>("", null)) return "Fail 29"
    if (isEqualAnyNullableRight(null, A(""))) return "Fail 30"
    if (isEqualAnyNullableRight(A(""), A("a"))) return "Fail 31"
    if (isEqualNullableUnboxedLeft(A(""), A("a"))) return "Fail 32"

Response:
if (!isEqualNullableUnboxedLeft(A(""), A(""))) return "Fail 33"
    if (isEqualNullableUnboxedRight(A(""), A("a"))) return "Fail 34"
    if (!isEqualNullableUnboxedRight(A("a"), A("a"))) return "Fail 35"<|endoftext|>


Prompt:
public fun insert(index: Int, value: Double): StringBuilder

    /**
     * Inserts the specified character [value] into this string builder at the specified [index] and returns this instance.
     *
     * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
     */
    @SinceKotlin("1.4")

Response:
public fun insert(index: Int, value: Char): StringBuilder

    /**
     * Inserts characters in the specified character array [value] into this string builder at the specified [index] and returns this instance.
     *
     * The inserted characters go in same order as in the [value] character array, starting at [index].
     *<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithThreeTypeParameters<*, *, *> & InterfaceWithTwoTypeParameters<*, *> & ClassWithThreeTypeParameters<*, *, *>")!>x<!>.x
    }
}

// TESTCASE NUMBER: 4
fun case_4(x: ClassWithSixTypeParameters<*, *, *, *, *, *>?) {

Response:
if (x is InterfaceWithTwoTypeParameters<*, *>) {
        <!DEBUG_INFO_EXPRESSION_TYPE("ClassWithSixTypeParameters<*, *, *, *, *, *>? & InterfaceWithTwoTypeParameters<*, *> & ClassWithSixTypeParameters<*, *, *, *, *, *>")!>x<!><|endoftext|>


Prompt:
// so we don't use it for the same reasons as why we don't use it in JDK7. ThreadLocalRandom worked on
        // SDK 24, but starting SDK 25 it had bugs in seeding so that it would return the same sequence of values
        // for all application starts. That will be fixed in SDK 34. Therefore, do not use ThreadLocalRandom until
        // then.

Response:
if (sdkIsNullOrAtLeast(34)) PlatformThreadLocalRandom() else super.defaultPlatformRandom()

}<|endoftext|>


Prompt:
--help, -h -> Usage info
""".trimIndent()
        assertEquals(expectedOutput, helpOutput)
    }

    @Test
    fun testHelpMessageWithSubcommands() {
        abstract class CommonOptions(name: String, actionDescription: String): Subcommand(name, actionDescription) {

Response:
val numbers by argument(ArgType.Int, "numbers", description = "Numbers").vararg()
        }
        class Summary: CommonOptions("summary", "Calculate summary") {
            val invert by option(ArgType.Boolean, "invert", "i", "Invert results")
            var result: Int = 0

            override fun execute() {
                result = numbers.sum()<|endoftext|>


Prompt:
result.add(FirTypeRefSource(returnTypeRef, returnTypeRef.source))
        }
        else -> return null
    }

    return result
}

data class FirTypeRefSource(val typeRef: FirTypeRef?, val source: KtSourceElement?) {
    override fun toString(): String {

Response:
return "FirTypeRefSource(typeRef=${typeRef?.render()}, source=${source?.kind?.javaClass?.simpleName})"
    }
}

val FirClassLikeSymbol<*>.classKind: ClassKind?
    get() = (this as? FirClassSymbol<*>)?.classKind<|endoftext|>


Prompt:
override val project: Project,
    private val binaryRoots: Collection<Path>,
) : KtModuleWithModifiableDependencies(), KtSdkModule {
    override val analyzerServices: PlatformDependentAnalyzerServices
        get() = platform.getAnalyzerServices()

    override fun getBinaryRoots(): Collection<Path> = binaryRoots

Response:
override val directRegularDependencies: MutableList<KtModule> = mutableListOf()
    override val directDependsOnDependencies: MutableList<KtModule> = mutableListOf()
    override val directFriendDependencies: MutableList<KtModule> = mutableListOf()
}<|endoftext|>


Prompt:
internal var actualResources: SourceDirectorySet = createDefaultSourceDirectorySet(project, "$name resources")

    override val resources: SourceDirectorySet get() = actualResources

    override fun kotlin(configure: SourceDirectorySet.() -> Unit): SourceDirectorySet = kotlin.apply {
        configure(this)
    }

Response:
override fun kotlin(configure: Action<SourceDirectorySet>): SourceDirectorySet =
        kotlin { configure.execute(this) }

    override fun languageSettings(configure: Action<LanguageSettingsBuilder>): LanguageSettingsBuilder = languageSettings {
        configure.execute(this)
    }

    override fun languageSettings(configure: LanguageSettingsBuilder.() -> Unit): LanguageSettingsBuilder =<|endoftext|>


Prompt:
package org.jetbrains.kotlin.abicmp

import org.jetbrains.org.objectweb.asm.Opcodes

class AndFlag(private val flag: Int, private val name: String) : (Int) -> String? {
    override fun invoke(p1: Int): String? {
        return if (p1 and flag != 0) name else null
    }
}

Response:
class AndNotFlag(private val flag: Int, private val name: String) : (Int) -> String? {
    override fun invoke(p1: Int): String? {
        return if (p1 and flag == 0) name else null
    }
}

fun Int.isPrivate() =
    this and Opcodes.ACC_PRIVATE != 0

fun Int.isSynthetic() =<|endoftext|>


Prompt:
// EXPECTED_REACHABLE_NODES: 1283
// CHECK_VARS_COUNT: function=test count=1 TARGET_BACKENDS=JS

class A {
    var i = 23
}

fun test(a: A): String {
    var x = ++a.i
    if (x != 24) return "fail1: $x"

    a.i++

Response:
if (a.i != 25) return "fail2: $a.i"

    // a.i++, used as expression, requires temporary variable

    return "OK"
}

fun box(): String = test(A())<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
import org.jetbrains.kotlin.fir.types.FirTypeRef
import org.jetbrains.kotlin.name.Name

Response:
class Column(val name: Name, val type: FirTypeRef)

sealed interface CallShapeData {
    class Schema(val columns: List<Column>) : CallShapeData

    class Scope(val token: FirClassSymbol<FirClass>, val columns: List<Column>) : CallShapeData

    class RefinedType(val scopes: List<FirRegularClassSymbol>) : CallShapeData
}<|endoftext|>


Prompt:
context.trace, context.missingSupertypesResolver
            )

            val eagerChecksAllowed = context.languageVersionSettings.getFlag(AnalysisFlags.extendedCompilerChecks)
            val unresolvedLazySupertypesByDefault = descriptor is ConstructorDescriptor || descriptor is FakeCallableDescriptorForObject

Response:
if (eagerChecksAllowed || !unresolvedLazySupertypesByDefault && !errorReported) {
                // The constructed class' own supertypes are not resolved after constructor call,
                // so its containing declaration should not be checked.
                // Dispatch receiver is checked before for case of inner class constructor call.<|endoftext|>


Prompt:
object ActualFunctionWithDefaultParameters :
            WeakIncompatible<Nothing>("actual function cannot have default argument values, they should be declared in the expected function")

        // Properties

        object PropertyKind : WeakIncompatible<Nothing>("property kinds are different (val vs var)")
        object PropertyLateinitModifier : WeakIncompatible<Nothing>("modifiers are different (lateinit)")

Response:
object PropertyConstModifier : WeakIncompatible<Nothing>("modifiers are different (const)")
        object PropertySetterVisibility : WeakIncompatible<Nothing>("setter visibility is different")

        // Classifiers

        object ClassKind : WeakIncompatible<Nothing>("class kinds are different (class, interface, object, enum, annotation)")<|endoftext|>


Prompt:
val block = irBlock {
            flattenExpressionTo(expression, instance)
        }
        val expressions = removeExtraSetVariablesFromExpressionList(block, variables)
        if (block.statements.isNotEmpty()) {
            +block.unwrapBlock()
        }
        return expressions
    }

    /**
     * Takes not transformed expression and initialized given MfvcNodeInstance with transformed version of it

Response:
*/
    private fun IrBlockBuilder.flattenExpressionTo(expression: IrExpression, instance: MfvcNodeInstance) {
        val rootNode = replacements.getRootMfvcNodeOrNull(
            if (expression is IrConstructorCall) expression.symbol.owner.constructedClass else expression.type.erasedUpperBound
        )<|endoftext|>


Prompt:
@kotlin.jvm.JvmName(name = "sumOfShort")
public fun kotlin.collections.Iterable<kotlin.Short>.sum(): kotlin.Int

@kotlin.jvm.JvmName(name = "sumOfUByte")
@kotlin.SinceKotlin(version = "1.5")

Response:
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalUnsignedTypes::class})
public fun kotlin.collections.Iterable<kotlin.UByte>.sum(): kotlin.UInt

@kotlin.jvm.JvmName(name = "sumOfUInt")
@kotlin.SinceKotlin(version = "1.5")<|endoftext|>


Prompt:
* Returns the smallest value according to the provided [comparator]
 * among all values produced by [selector] function applied to each element in the array.
 *
 * @throws NoSuchElementException if the array is empty.
 */
@SinceKotlin("1.4")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType

Response:
@kotlin.internal.InlineOnly
public inline fun <R> IntArray.minOfWith(comparator: Comparator<in R>, selector: (Int) -> R): R {
    if (isEmpty()) throw NoSuchElementException()
    var minValue = selector(this[0])
    for (i in 1..lastIndex) {
        val v = selector(this[i])<|endoftext|>


Prompt:
// Generated function type names aren't included in the top-level classifier names set.
            emptySet()

        override fun getTopLevelCallableNamesInPackage(packageFqName: FqName): Set<Name> = emptySet()

        override fun mayHaveTopLevelClassifier(classId: ClassId): Boolean = mayHaveSyntheticFunctionType(classId)

Response:
override fun mayHaveTopLevelCallable(packageFqName: FqName, name: Name): Boolean = false
    }

    override fun getClassLikeSymbolByClassId(classId: ClassId): FirRegularClassSymbol? {
        val functionTypeKind = classId.getAcceptableFunctionTypeKind() ?: return null
        return cache.getValue(classId, functionTypeKind)
    }<|endoftext|>


Prompt:
package org.jetbrains.kotlin.fir.resolve.transformers.contracts

import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.resolve.ScopeSession
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.*

class FirContractResolveTransformer(

Response:
session: FirSession,
    scopeSession: ScopeSession,
    outerBodyResolveContext: BodyResolveContext? = null,
) : FirAbstractContractResolveTransformerDispatcher(
    session,
    scopeSession,
    outerBodyResolveContext,
) {
    override val contractDeclarationsTransformer: FirDeclarationsContractResolveTransformer
        get() = FirDeclarationsContractResolveTransformer()
}<|endoftext|>


Prompt:
}

    open fun visitStringConcatenationCall(stringConcatenationCall: FirStringConcatenationCall) {
        visitElement(stringConcatenationCall)
    }

    final override fun visitThrowExpression(throwExpression: FirThrowExpression, data: Nothing?) {
        visitThrowExpression(throwExpression)
    }

Response:
open fun visitThrowExpression(throwExpression: FirThrowExpression) {
        visitElement(throwExpression)
    }

    final override fun visitVariableAssignment(variableAssignment: FirVariableAssignment, data: Nothing?) {
        visitVariableAssignment(variableAssignment)
    }

    open fun visitVariableAssignment(variableAssignment: FirVariableAssignment) {<|endoftext|>


Prompt: <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.foo()<!>) :

Response: super(<!ARGUMENT_TYPE_MISMATCH!>x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() +<|endoftext|>


Prompt:
class TryWithFinallyInfo(val onExit: IrExpression) : TryInfo()

class BlockInfo(val parent: BlockInfo? = null) {
    val variables = mutableListOf<VariableInfo>()
    val infos: Stack<ExpressionInfo> = parent?.infos ?: Stack()
    var activeLocalGaps = 0

Response:
fun hasFinallyBlocks(): Boolean = infos.firstIsInstanceOrNull<TryWithFinallyInfo>() != null

    internal inline fun forEachBlockUntil(tryWithFinallyInfo: TryWithFinallyInfo, onBlock: BlockInfo.() -> Unit) {
        var current: BlockInfo? = this
        while (current != null && current != tryWithFinallyInfo.blockInfo) {
            current.onBlock()<|endoftext|>


Prompt:
): GradleCompileStatisticsData? {
    val result = event.result
    val taskPath = event.descriptor.taskPath
    return prepareData(getTaskResult(event), taskPath, result.startTime, result.endTime - result.startTime, projectName, uuid,
                       label, kotlinVersion, buildOperationRecord, onlyKotlinTask, additionalTags, metricsToShow)
}

Response:
internal fun prepareData(
    taskResult: TaskExecutionState?,
    taskPath: String,
    startTime: Long,
    finishTime: Long,
    projectName: String,
    uuid: String,
    label: String?,
    kotlinVersion: String,
    buildOperationRecord: BuildOperationRecord,
    onlyKotlinTask: Boolean = true,<|endoftext|>


Prompt:
* @param bufferSize the buffer size to use when copying.
 * @return the [target] file.
 * @throws NoSuchFileException if the source file doesn't exist.
 * @throws FileAlreadyExistsException if the destination file already exists and [overwrite] argument is set to `false`.
 * @throws IOException if any errors occur while copying.
 */

Response:
public fun File.copyTo(target: File, overwrite: Boolean = false, bufferSize: Int = DEFAULT_BUFFER_SIZE): File {
    if (!this.exists()) {
        throw NoSuchFileException(file = this, reason = "The source file doesn't exist.")
    }

    if (target.exists()) {
        if (!overwrite)<|endoftext|>


Prompt:
while (char and 0xff00ffff.toInt() == Lexer.CHAR_FLAGS) {
            lexemes.next()
            flags = (char shr 16) and flagsBitMask
            char = lexemes.currentChar
        }
        // The terminal is some kind of group: (E). Call processExpression for it.

Response:
if (char and 0x8000ffff.toInt() == Lexer.CHAR_LEFT_PARENTHESIS) {
            var newFlags = flags
            if (char and 0xff00ffff.toInt() == Lexer.CHAR_NONCAP_GROUP) {
                newFlags = (char shr 16) and flagsBitMask
            }<|endoftext|>


Prompt:
// Note 1: can be combined with org.jetbrains.kotlin.resolve.constants.ConstantValue but where is some questions to `AnnotationValue`.
// Note 2: if we are not going to implement previous idea, then this class can be moved to `fir` module.
// The problem here is that `ConstantValue` somehow must be accessible to `EvaluatedConstTracker`

Response:
// which in turn must be accessible to `CommonConfigurationKeys`.
sealed class ConstantValue<out T>(open val value: T) {
    abstract fun <R, D> accept(visitor: AnnotationArgumentVisitor<R, D>, data: D): R

    override fun equals(other: Any?): Boolean = this === other || value == (other as? ConstantValue<*>)?.value<|endoftext|>


Prompt:
import org.jetbrains.kotlin.js.translate.utils.*
import org.jetbrains.kotlin.js.translate.utils.JsAstUtils.prototypeOf
import org.jetbrains.kotlin.js.translate.utils.JsAstUtils.pureFqn
import org.jetbrains.kotlin.resolve.DescriptorUtils

Response:
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassNotAny
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperInterfaces
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal
import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension<|endoftext|>


Prompt:
inline fun case_3(block: () -> Unit) {
    throw Exception()
    <!CONTRACT_NOT_ALLOWED!>contract<!> {
        callsInPlace(block, InvocationKind.UNKNOWN)
    }
    return block()
}

/*
 * TESTCASE NUMBER: 4
 * ISSUES: KT-26191
 */

Response:
inline fun case_4(block: () -> Unit) {
    .0009
    return <!CONTRACT_NOT_ALLOWED!>contract<!> {
        callsInPlace(block, InvocationKind.EXACTLY_ONCE)
    }
}

/*
 * TESTCASE NUMBER: 5
 * ISSUES: KT-26191
 */<|endoftext|>


Prompt:
override val isPubliclyVisible: Boolean get() = original.isPubliclyVisible

        override val hasTopLevel: Boolean get() = true

        override val visibleCrossFile: Boolean
            get() = original.visibleCrossFile

        override fun topLevelSignature(): IdSignature = this

        override fun nearestPublicSig(): IdSignature = this

Response:
override fun packageFqName(): FqName = original.packageFqName()

        override fun equals(other: Any?): Boolean {
            return other is LoweredDeclarationSignature && original == other.original && stage == other.stage && index == other.index
        }

        private val hashCode = (index * 31 + stage) * 31 + original.hashCode()<|endoftext|>


Prompt:
while (true) {
            x.length
            break
        }
        y += ""
    }
}

fun test39() {
    val x: Any? = materialize()
    var y = x
    runWithoutContract {
        require(y is String)
        while (true) {
            x.<!UNRESOLVED_REFERENCE!>length<!>
            break
        }

Response:
y <!UNRESOLVED_REFERENCE!>+=<!> ""
    }
}

fun test40() {
    val x: Any? = materialize()
    var y = x
    exactlyOnce {
        require(y is Int)
        while (true) {
            x.inc()
            break
        }
        y++
    }
}

fun test41() {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler
import org.jetbrains.kotlin.config.CompilerConfiguration

Response:
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.integration.KotlinIntegrationTestBase
import org.jetbrains.kotlin.script.loadScriptingPlugin<|endoftext|>


Prompt:
val superInterfaces = this.getSuperInterfaces()
        val superInterfacesImplementedInterfaces = superInterfaces.flatMap { it.implementedInterfaces }
        return (superClassImplementedInterfaces +
                superInterfacesImplementedInterfaces +
                superInterfaces).distinct()
    }

internal val IrFunction.isTypedIntrinsic: Boolean

Response:
get() = annotations.hasAnnotation(KonanFqNames.typedIntrinsic)

internal val IrConstructor.isConstantConstructorIntrinsic: Boolean
    get() = annotations.hasAnnotation(KonanFqNames.constantConstructorIntrinsic)

internal val IrClass.isArray: Boolean<|endoftext|>


Prompt:
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) <!CONFLICTING_OVERLOADS!>constructor(arg: Invariant<T>)<!>
    }
    <!CONFLICTING_OVERLOADS!>fun <T: UserInterface> TestTypeParameterWithIdenticalUpperBoundsC(arg: Invariant<T>)<!> {}

Response:
class TestTypeParameterWithIdenticalUpperBoundsCReverse<T: UserInterface> {
        <!CONFLICTING_OVERLOADS!>constructor(arg: Invariant<T>)<!>
    }<|endoftext|>


Prompt:
// ISSUE: KT-36057

fun String.foo() {}

fun test_1(a: Any?) {
    when (a) {
        is String, is Any -> a.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>() // Should be Bad
    }
}

fun test_2(a: Any?) {

Response:
if (a is String || a is Any) {
        a.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>() // Should be Bad
    }
}

fun test_3(a: Any?, b: Boolean) {
    when (a) {<|endoftext|>


Prompt:
val notNullableArgumentType = argumentType.makeNotNullable()
        val isApplicable = argumentTypeResolver.isSubtypeOfForArgumentType(notNullableArgumentType, parameterType)
        return if (isApplicable) NULLABLE_ARGUMENT_TYPE_MISMATCH else null
    }

    private fun CallCandidateResolutionContext<*>.checkReceiverTypeError(): Unit = check {

Response:
val extensionReceiver = candidateDescriptor.extensionReceiverParameter
        val dispatchReceiver = candidateDescriptor.dispatchReceiverParameter

        // For the expressions like '42.(f)()' where f: String.() -> Unit we'd like to generate a type mismatch error on '1',
        // not to throw away the candidate, so the following check is skipped.<|endoftext|>


Prompt: 0x2119, 0x211e, 0x2123,

Response: 0x212a, 0x212e, 0x2130, 0x2134, 0x2135, 0x2139, 0x213d, 0x2140, 0x2145, 0x2146, 0x214a, 0x214d, 0x2150, 0x2160, 0x2183, 0x2185, 0x2189, 0x218c, 0x2190,<|endoftext|>


Prompt:
package org.jetbrains.kotlin.test

import com.intellij.openapi.application.PathManager.PROPERTY_CONFIG_PATH
import com.intellij.openapi.application.PathManager.PROPERTY_SYSTEM_PATH
import com.intellij.openapi.util.io.FileUtil
import java.io.File

Response:
// It's important that this is not created per test, but rather per process.
object IdeaSystemPropertiesForParallelRunConfigurator {
    private val GRADLE_WORKER = System.getProperty("org.gradle.test.worker") ?: ""
    //TODO: try to remove folder on jvm shutdown (there are some flashing test with deleteOnExit = true)<|endoftext|>


Prompt:
if (superQName == qualifiedName || superQName == mappedQName) return true

                    if (deep) {
                        if (checkSuperTypeByFQName(superDescriptor, qualifiedName, true)) {
                            return true
                        }
                    }
                }
            }

            return false
        }

        private val ktTokenToPsiModifier = listOf(

Response:
KtTokens.PUBLIC_KEYWORD to PsiModifier.PUBLIC,
            KtTokens.INTERNAL_KEYWORD to PsiModifier.PUBLIC,
            KtTokens.PROTECTED_KEYWORD to PsiModifier.PROTECTED,
        )
    }
}<|endoftext|>


Prompt:
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
        val foo = 0

        <!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
        object Obj2 {}
    }
}

class C {

Response:
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
    fun Int.set(a: String, v: Int)<!> {}

    <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter<|endoftext|>