Prompt:
approximateToSuperType(argumentType, conf, depth) ?: continue@loop // null means that this type we can leave as is
                    if (approximatedSuperType.isTrivialSuper()) {
                        val approximatedSubType =
                            approximateToSubType(argumentType, conf, depth) ?: continue@loop // seems like this is never null

Response:
if (!approximatedSubType.isTrivialSub()) {
                            newArguments[index] = createTypeArgument(approximatedSubType, TypeVariance.IN)
                            continue@loop
                        }
                    }

                    if (AbstractTypeChecker.equalTypes(this, argumentType, approximatedSuperType)) {
                        newArguments[index] = approximatedSuperType.asTypeArgument()<|endoftext|>


Prompt:
fun freshName() =
            suggestedName + "_" + i

        while (isReserved(freshName())) {
            i++
        }

        suggestedNameLastIdx[suggestedName] = i

        return freshName()
    }
}

fun NameTable<IrDeclaration>.dump(): String =

Response:
"Names: \n" + names.toList().joinToString("\n") { (declaration, name) ->
        val decl: FqName? = (declaration as IrDeclarationWithName).fqNameWhenAvailable
        val declRef = decl ?: declaration
        "---  $declRef => $name"
    }<|endoftext|>


Prompt: val test6 = "".bar(40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, u = 20, v = 19,

Response:
w = 18, x = 17, y = 16, z = 15, aa = 14, bb = 13, cc = 12, dd = 11, ee = 10, ff = 9, gg = 8, hh = 7, ii = 6,
                           jj = 5, kk = 4, ll = 3, mm = 2, nn = 1)<|endoftext|>


Prompt:
val first = BoxedTypes(
            true as java.lang.Boolean,
            '#' as java.lang.Character,
            3.toByte() as java.lang.Byte,
            10.toShort() as java.lang.Short,
            -300 as java.lang.Integer,
            -5.0f as java.lang.Float,
            Long.MAX_VALUE as java.lang.Long,

Response:
3.14 as java.lang.Double)

    first.writeToParcel(parcel, 0)

    val bytes = parcel.marshall()
    parcel.unmarshall(bytes, 0, bytes.size)
    parcel.setDataPosition(0)

    val first2 = parcelableCreator<BoxedTypes>().createFromParcel(parcel)<|endoftext|>


Prompt:
* Converts [java.time.Duration][java.time.Duration] value to [kotlin.time.Duration][Duration] value.
 *
 * Accuracy of conversion:
 * - Durations in range of ±146 years are converted exactly.
 * - Durations out of that range, but in range of ±146 million years can be rounded to millisecond precision.

Response:
* - Durations greater than that are converted to a positive or negative infinite Duration (see [Duration.INFINITE]).
 */
@SinceKotlin("1.6")
@WasExperimental(ExperimentalTime::class)
@kotlin.internal.InlineOnly
public inline fun java.time.Duration.toKotlinDuration(): Duration =<|endoftext|>


Prompt:
putReifiedOperationMarkerIfTypeIsReifiedParameter(typeOperand, operationKind)
                    mv.checkcast(boxedRightType)
                } else {
                    assert(expression.operator == IrTypeOperator.CAST) { "IrTypeOperator.SAFE_CAST should have been lowered." }
                    TypeIntrinsics.checkcast(mv, kotlinType, boxedRightType, false)
                }

Response:
MaterialValue(this, boxedRightType, expression.type)
            }

            IrTypeOperator.REINTERPRET_CAST -> {
                val targetType = typeMapper.mapType(typeOperand)
                expression.argument.accept(this, data).materialize()
                MaterialValue(this, targetType, typeOperand)
            }

            IrTypeOperator.INSTANCEOF -> {<|endoftext|>


Prompt:
c.trace.record(BindingContext.VALUE_PARAMETER, parameter, descriptor)
                    descriptor
                }
            }

            override fun visitContextReceiverList(contextReceiverList: KtContextReceiverList) {
                checkContextReceiversAreEnabled(c.trace, languageVersionSettings, contextReceiverList)
            }

Response:
override fun visitDynamicType(type: KtDynamicType) {
                result = type(dynamicCallableDescriptors.dynamicType.replaceAnnotations(annotations))
                if (!dynamicTypesSettings.dynamicTypesAllowed) {
                    c.trace.report(UNSUPPORTED.on(type, "Dynamic types are not supported in this context"))
                }
            }<|endoftext|>


Prompt:
return "Wrong elements for MinL..MinL step 1: $list4"
    }

    val list5 = ArrayList<Char>()
    val range5 = MinC..MinC step 1
    for (i in range5) {
        list5.add(i)
        if (list5.size > 23) break
    }
    if (list5 != listOf<Char>(MinC)) {

Response:
return "Wrong elements for MinC..MinC step 1: $list5"
    }

    return "OK"
}<|endoftext|>


Prompt:
if (!(-1 in 1L..<3L) != !range0.contains(-1)) throw AssertionError()
    if (!(-1 !in 1L..<3L) != range0.contains(-1)) throw AssertionError()
    // no local optimizations
    if (element2 in 1L..<3L != range0.contains(element2)) throw AssertionError()

Response:
if (element2 !in 1L..<3L != !range0.contains(element2)) throw AssertionError()
    if (!(element2 in 1L..<3L) != !range0.contains(element2)) throw AssertionError()
    if (!(element2 !in 1L..<3L) != range0.contains(element2)) throw AssertionError()
}<|endoftext|>


Prompt:
* control--and-data-flow-analysis, control-flow-graph, expressions-1, conditional-expressions -> paragraph 2 -> sentence 1
 * control--and-data-flow-analysis, control-flow-graph, expressions-1, boolean-operators -> paragraph 0 -> sentence 0
 * control--and-data-flow-analysis, control-flow-graph, statements-1 -> paragraph 0 -> sentence 0
 */

Response:
enum class Color { RED, GREEN, BLUE }

fun foo(arr: Array<Color>): Color {
    loop@ for (color in arr) {
        <!DEBUG_INFO_IMPLICIT_EXHAUSTIVE!>when (color) {
            Color.RED -> return color
            Color.GREEN -> break@loop
            Color.BLUE -> if (arr.size == 1) return color else continue@loop<|endoftext|>


Prompt:
operator fun A.component2(): String = "n"

fun box(): String {
    var i = 0;
    var s = ""
    for ((a, b) in C(0)..C(2)) {
        i = a;
        s = b;
    }

    if (i != 1) return "i != 1, it: " + i

Response:
if (s != "n") return "s != 'n', it: " + s

    return "OK"
}<|endoftext|>


Prompt:
}
}

// TESTCASE NUMBER: 12
fun case_12(value_1: Int, value_2: Int, value_3: Int, value_4: Int?) {
    var mutableValue1 = value_2
    var mutableValue2 = value_3

    when (value_1) {

Response:
<!UNUSED_CHANGED_VALUE!>mutableValue1++<!> -> {}
        <!UNUSED_CHANGED_VALUE!>mutableValue2--<!> -> {}
        value_4!! -> {}
    }
}

// TESTCASE NUMBER: 13<|endoftext|>


Prompt:
add(intrinsics.writeSharedBox) { call, context: JsGenerationContext ->
                val args = translateCallArguments(call, context)
                val box = args[0]
                val value = args[1]
                jsAssignment(JsNameRef(Namer.SHARED_BOX_V, box), value)
            }

Response:
val suspendInvokeTransform: (IrCall, JsGenerationContext) -> JsExpression = { call, context: JsGenerationContext ->
                // Because it is intrinsic, we know everything about this function
                // There is callable reference as extension receiver
                val invokeFun = invokeFunForLambda(call)

                val jsInvokeFunName = context.getNameForMemberFunction(invokeFun)<|endoftext|>


Prompt:
override val diagnosticClass get() = NameInConstraintIsNotATypeParameter::class
        val typeParameterName: Name
        val typeParametersOwner: KtSymbol
    }

    interface BoundOnTypeAliasParameterNotAllowed : KtFirDiagnostic<KtTypeReference> {
        override val diagnosticClass get() = BoundOnTypeAliasParameterNotAllowed::class
    }

Response:
interface ReifiedTypeParameterNoInline : KtFirDiagnostic<KtTypeParameter> {
        override val diagnosticClass get() = ReifiedTypeParameterNoInline::class
    }

    interface TypeParametersNotAllowed : KtFirDiagnostic<KtDeclaration> {
        override val diagnosticClass get() = TypeParametersNotAllowed::class
    }<|endoftext|>


Prompt:
package org.jetbrains.kotlin.scripting.ide_common.idea.util

import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.idea.FrontendInternals

Response:
import org.jetbrains.kotlin.scripting.ide_common.idea.resolve.ResolutionFacade
import org.jetbrains.kotlin.scripting.ide_common.idea.resolve.frontendService
import org.jetbrains.kotlin.scripting.ide_common.idea.resolve.getDataFlowValueFactory<|endoftext|>


Prompt:
fun jvm(name: String) = jvm(name) { }
    fun jvm(name: String, configure: Action<KotlinJvmTarget>) = jvm(name) { configure.execute(this) }
    fun jvm(configure: Action<KotlinJvmTarget>) = jvm { configure.execute(this) }

    fun androidTarget(
        name: String = "android",

Response:
configure: KotlinAndroidTarget.() -> Unit = { }
    ): KotlinAndroidTarget =
        configureOrCreate(
            name,
            @Suppress("DEPRECATION")
            presets.getByName("android") as KotlinAndroidTargetPreset,
            configure
        )

    fun androidTarget() = androidTarget("android") { }<|endoftext|>


Prompt:
package org.jetbrains.kotlin.backend.jvm.lower

import org.jetbrains.kotlin.backend.common.ClassLoweringPass
import org.jetbrains.kotlin.backend.common.phaser.PhaseDescription
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext

Response:
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.declarations.IrClass<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.analysis.diagnostics.native.FirNativeErrors.EMPTY_OBJC_NAME
import org.jetbrains.kotlin.fir.analysis.diagnostics.native.FirNativeErrors.INAPPLICABLE_EXACT_OBJC_NAME


Prompt:
classReader.accept(selectiveClassVisitor, ClassReader.SKIP_CODE)

        // 3. Sort fields and methods as their order is not important
        sortClassMembers(classNode)

        // 4. Snapshot the class
        val classMemberLevelSnapshot = if (granularity == CLASS_MEMBER_LEVEL) {
            JavaClassMemberLevelSnapshot(

Response:
classAbiExcludingMembers = JavaElementSnapshot(classNode.name, snapshotClassExcludingMembers(classNode)),
                fieldsAbi = classNode.fields.map { JavaElementSnapshot(it.name, snapshotField(it)) },
                methodsAbi = classNode.methods.map { JavaElementSnapshot(it.name, snapshotMethod(it, classNode.version)) }
            )
        } else {<|endoftext|>


Prompt:
fun foo() {
    var x = 0
    x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x - 1 - 1

    x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x / 1
    x = 1 / x

Response:
<!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> -1 + x
}<|endoftext|>


Prompt:
package kotlin.metadata.internal

import kotlin.metadata.*
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.serialization.StringTable

Response:
public fun KmAnnotation.writeAnnotation(strings: StringTable): ProtoBuf.Annotation.Builder =
    ProtoBuf.Annotation.newBuilder().apply {
        id = strings.getClassNameIndex(className)
        for ((name, argument) in arguments) {
            addArgument(ProtoBuf.Annotation.Argument.newBuilder().apply {<|endoftext|>


Prompt:
public abstract fun getAnonymousObjectSymbol(psi: KtObjectLiteralExpression): KtAnonymousObjectSymbol
    public abstract fun getClassOrObjectSymbol(psi: KtClassOrObject): KtClassOrObjectSymbol?
    public abstract fun getNamedClassOrObjectSymbol(psi: KtClassOrObject): KtNamedClassOrObjectSymbol?

Response:
public abstract fun getPropertyAccessorSymbol(psi: KtPropertyAccessor): KtPropertyAccessorSymbol
    public abstract fun getClassInitializerSymbol(psi: KtClassInitializer): KtClassInitializerSymbol
    public abstract fun getDestructuringDeclarationEntrySymbol(psi: KtDestructuringDeclarationEntry): KtLocalVariableSymbol<|endoftext|>


Prompt:
override fun copyOf(): Freezable = copyK2MetadataCompilerArguments(this, K2MetadataCompilerArguments())

    override fun configureAnalysisFlags(collector: MessageCollector, languageVersion: LanguageVersion): MutableMap<AnalysisFlag<*>, Any> =
        super.configureAnalysisFlags(collector, languageVersion).also {
            it[AnalysisFlags.metadataCompilation] = true

Response:
}

    override fun configureExtraLanguageFeatures(map: HashMap<LanguageFeature, LanguageFeature.State>) {
        map[LanguageFeature.MultiPlatformProjects] = LanguageFeature.State.ENABLED
    }
}<|endoftext|>


Prompt: ExpectedData(0x3931ac68c5f1b2c9UL, 0xa53a6b64b1ac85c9UL, 0xd50e7f86ee1b832bUL, 0x7bab08fdd26ba0a4UL, 0x7587743c18fe2475UL),

Response: ExpectedData(0xb98fb0606f416754UL, 0xdbfaae9642b3205aUL, 0xf676a1339402bcb9UL, 0xf4f12a5b1ac11f29UL, 0x7db8bad81249dee4UL),<|endoftext|>


Prompt:
assert64BitHash("a", 12917804110809363939UL)
        assert64BitHash("abc", 2640714258260161385UL)
        assert64BitHash("a".repeat(20), 15065261471293997870UL)
        assert64BitHash("b".repeat(50), 1117739638843767388UL)

Response:
assert64BitHash("Hello World!".repeat(40), 9211247178963271761UL)
    }

    fun testSimple128() {
        assert128BitHash("a", 7969074168056553668UL, 5955762262185338209UL)
        assert128BitHash("abc", 4143508125394299908UL, 11566915719555882565UL)<|endoftext|>


Prompt:
val writerDescriptor = writerDeclaration.getDeclarationDescriptorIncludingConstructors(bindingContext)
        // Access is after some writerDeclaration
        if (variableContainingDeclaration != writerDescriptor && !accessElement.before(writerDeclaration)) {
            return false
        }
    }
    // Access is before all writers
    return true
}

Response:
private fun DeclarationDescriptorWithVisibility.isInvisibleFromOtherModules(): Boolean {
    if (DescriptorVisibilities.INVISIBLE_FROM_OTHER_MODULES.contains(visibility)) return true

    val containingDeclaration = containingDeclaration
    return containingDeclaration is DeclarationDescriptorWithVisibility && containingDeclaration.isInvisibleFromOtherModules()
}<|endoftext|>


Prompt:
assertEquals("17\n17\n42\n42\n", sb.toString())
    return "OK"
}

fun <T> foo(x: Any?) {
    val y = x as T
    sb.appendLine(y.toString())
}

fun <T> bar(x: Any?) {
    val y = x as? T

Response:
sb.appendLine(y.toString())
}<|endoftext|>


Prompt:
// TARGET_BACKEND: JVM

// WITH_STDLIB

interface In<in E>
open class A : In<A>
open class B : In<B>

inline fun <reified T : Any> select(x: T, y: T) = T::class.java.simpleName

Response:
// This test checks mostly that no StackOverflow happens while mapping type argument of select-call (In<A & B>)
// See KT-10972
fun foo(): String = select(A(), B())

fun box(): String {
    if (foo() != "In") return "fail"
    return "OK"
}<|endoftext|>


Prompt:
return filteredOverridden.minOf { (it.member.fir as FirMemberDeclaration).modality ?: Modality.ABSTRACT }
    }

    private fun <D : FirCallableSymbol<*>> realOverridden(
        symbol: D,
        scope: FirTypeScope,
        processDirectOverridden: ProcessOverriddenWithBaseScope<D>,

Response:
): Collection<MemberWithBaseScope<D>> {
        val result = mutableSetOf<MemberWithBaseScope<D>>()

        collectRealOverridden(symbol, scope, result, mutableSetOf(), processDirectOverridden)

        return result
    }

    private fun <D : FirCallableSymbol<*>> collectRealOverridden(
        symbol: D,
        scope: FirTypeScope,<|endoftext|>


Prompt:
// !LANGUAGE: -ApproximateAnonymousReturnTypesInPrivateInlineFunctions

private inline fun <!PRIVATE_INLINE_FUNCTIONS_RETURNING_ANONYMOUS_OBJECTS!>foo1<!>(crossinline f: () -> Int) = object {
    fun bar(): Int = f()
}

interface I1
interface I2

Response:
private inline fun <!PRIVATE_INLINE_FUNCTIONS_RETURNING_ANONYMOUS_OBJECTS!>foo2<!>(crossinline f: () -> Int) = object : I1 {
    fun bar(): Int = f()
}<|endoftext|>


Prompt:
protected fun serialize(comment: JsComment): JsAstProtoBuf.Comment {
        val builder = JsAstProtoBuf.Comment.newBuilder().apply {
            text = comment.text
            multiline = when (comment) {
                is JsSingleLineComment -> false
                is JsMultiLineComment -> true
                else -> error("Unknown type of comment ${comment.javaClass.name}")

Response:
}
        }
        return builder.build()
    }

    private inline fun withLocation(node: JsNode, fileConsumer: (Int) -> Unit, locationConsumer: (JsAstProtoBuf.Location) -> Unit, inner: () -> Unit) {
        val location = extractLocation(node)
        var fileChanged = false
        if (location != null) {<|endoftext|>


Prompt:
UsefulTestCase.assertSameElements(getMethodsOfClass(facadeWithB), "<clinit>", "b", "getB", "setB")

        if (IncrementalCompilation.isEnabledForJvm()) {
            checkWhen(touch("module1/src/a.kt"), null, packageClasses("module1", "module1/src/a.kt", "test.TestPackage"))

Response:
checkWhen(touch("module2/src/b.kt"), null, packageClasses("module2", "module2/src/b.kt", "test.TestPackage"))
        }
        else {
            val allClasses = myProject.outputPaths()
            checkWhen(touch("module1/src/a.kt"), null, allClasses)<|endoftext|>


Prompt:
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun ULongArray.onEach(action: (ULong) -> Unit): ULongArray {
    return apply { for (element in this) action(element) }
}

/**
 * Performs the given [action] on each element and returns the array itself afterwards.
 */
@SinceKotlin("1.4")

Response:
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun UByteArray.onEach(action: (UByte) -> Unit): UByteArray {
    return apply { for (element in this) action(element) }
}

/**
 * Performs the given [action] on each element and returns the array itself afterwards.
 */
@SinceKotlin("1.4")<|endoftext|>


Prompt:
funWithAtLeastOnceCallsInPlace {
        var <!NAME_SHADOWING!>value_1<!>: Int
        funWithAtLeastOnceCallsInPlace {
            value_1 = 10
        }
        funWithAtLeastOnceCallsInPlace {
            value_1.inc()
        }
        value_1++
    }

Response:
funWithAtLeastOnceCallsInPlace {
        value_1 = 1
    }
    value_1--
}<|endoftext|>


Prompt:
* MAIN LINK: declarations, classifier-declaration, class-declaration, abstract-classes -> paragraph 2 -> sentence 1
 * NUMBER: 3
 * DESCRIPTION: Abstract classes may contain one or more abstract members, which should be implemented in a subtype of this abstract class
 * HELPERS: checkType, functions
 */

// TESTCASE NUMBER: 1
// NOTE: attempt to implement inner abstract class as anonymous class

Response:
open class MainCase1() {
    private val priv = "privet"

    val implVal = object : MainCase1.InnerAbstractBase() {
        override fun foo(s: String) {
            println("object {$s}")
        }
    }

    abstract inner class InnerAbstractBase() {
        protected abstract fun foo(s: String)
        fun boo() {
            foo(priv)<|endoftext|>


Prompt:
).map { "\"$it\"" },
        fromKotlinOptionConverterProp = """
        this?.let { ${typeOf<JsSourceMapEmbedMode>()}.fromMode(it) }
        """.trimIndent(),
        toKotlinOptionConverterProp = """
        this?.mode
        """.trimIndent()
    )

Response:
object JsSourceMapNamesPolicies : DefaultValues(
        "null",
        typeOf<JsSourceMapNamesPolicy?>(),
        typeOf<String?>(),
        possibleValues = listOf(
            K2JsArgumentConstants.SOURCE_MAP_NAMES_POLICY_NO,<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>x<!>.funNullableT()
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>x<!>.funNullableAny()
        }
    }
}

// TESTCASE NUMBER: 27
fun case_27() {

Response:
if (Object.prop_1 == null == true == true == true == true == true == true == true == true == true == true == true == true == true == true)
    else {
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number & kotlin.Number?")!>Object.prop_1<!><|endoftext|>


Prompt:
fakeTypeArguments.add(TypeProjectionImpl(typeProjection.projectionKind, DONT_CARE))
    }

    val oldReceiverTypeConstructor = receiverType.constructor
    val receiverTypeConstructor = if (oldReceiverTypeConstructor is IntersectionTypeConstructor) {
        oldReceiverTypeConstructor.transformComponents { supertype ->

Response:
val fakeArguments = supertype.arguments.map { TypeProjectionImpl(it.projectionKind, DONT_CARE) }
            supertype.replace(fakeArguments)
        } ?: oldReceiverTypeConstructor
    } else {
        oldReceiverTypeConstructor
    }

    return KotlinTypeFactory.simpleTypeWithNonTrivialMemberScope(<|endoftext|>


Prompt:
}
            is PsiWildcardType -> {
                if (!isBounded) {
                    sb.append("?")
                } else {
                    if (isSuper) {
                        sb.append(PsiWildcardType.SUPER_PREFIX)
                    } else {
                        sb.append(PsiWildcardType.EXTENDS_PREFIX)
                    }

Response:
bound?.renderType(sb)
                }
            }
            is PsiPrimitiveType -> {
                sb.append(name)
            }
            else -> {
                sb.append(getCanonicalText(/* annotated = */ true))
            }
        }
    }

    private fun PsiReferenceList?.renderRefList(keyword: String, sortReferences: Boolean = true): String {<|endoftext|>


Prompt:
}
    r.run()
}

inline fun transform(crossinline c: suspend () -> Unit) {
    builder { c() }
}

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

// FILE: box.kt
import kotlin.coroutines.*
import helpers.*

fun box() : String {

Response:
var res = "FAIL 1"
    builder {
        test1 {
            res = "OK"
        }
    }
    if (res != "OK") return res

    res = "FAIL 2"
    builder {
        test2 {
            res = "OK"
        }
    }
    if (res != "OK") return res

    res = "FAIL 3"
    builder {<|endoftext|>


Prompt:
* `this` and other referenced types into the import collector passed as context.
     */
    context(ImportCollector)
    fun renderTo(appendable: Appendable)

    object Star : TypeRef {

        override fun substitute(map: TypeParameterSubstitutionMap) = this

        override fun toString(): String = "*"

        context(ImportCollector)

Response:
override fun renderTo(appendable: Appendable) {
            appendable.append(toString())
        }
    }
}

/**
 * Prints this type as a string with all its arguments and question marks, while recursively collecting
 * `this` and other referenced types into the import collector passed as context.
 */
context(ImportCollector)<|endoftext|>


Prompt:
suspend fun test1(p: String): String {
    return "A" + p
}

suspend fun test2(p: String): String {
    return p
}

suspend fun foo(): Array<String> {
    return externalLog(test1("B"))
}

suspend fun bar(): Array<String> {
    return externalLog(test2("C"), "D", test2("E"))

Response:
}

suspend fun qux(): Array<String> {
    return externalLog(test2("G"), test2("F"))
}

suspend fun test3(s1: String, s2: String): Array<Any?> {
    return arrayOf(s1, "Y", s2)
}

suspend fun tef(): Array<String> {<|endoftext|>


Prompt:
private fun generateWhenSubjectVariable(whenExpression: FirWhenExpression): IrVariable? {
        val subjectVariable = whenExpression.subjectVariable
        val subjectExpression = whenExpression.subject
        return when {
            subjectVariable != null -> subjectVariable.accept(this, null) as IrVariable
            subjectExpression != null -> {

Response:
applyParentFromStackTo(callablesGenerator.declareTemporaryVariable(convertToIrExpression(subjectExpression), "subject"))
            }
            else -> null
        }
    }

    private fun FirWhenBranch.toIrWhenBranch(whenExpressionType: ConeKotlinType): IrBranch {
        return convertWithOffsets { startOffset, _ ->
            val condition = condition<|endoftext|>


Prompt:
fun case_4(value_1: String, value_2: String, value_3: String) {
    when (value_1) {
        "..." + value_2 + "" + "$value_3" + "..." -> {}
        value_2 + getString() -> {}
    }
}

// TESTCASE NUMBER: 5

Response:
fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) {
    when (value_1) {
        when {
            value_2 > 1000 -> 1
            value_2 > 100 -> 2
            else -> 3
        } -> {}
        when (value_3) {
            true -> 1
            false -> 2
            null -> 3
        } -> {}<|endoftext|>


Prompt:
return PackagePartClassUtils.getPackagePartFqName(packageFqName, file.name)
}

private fun patchClassForName(className: FqName, oldPackage: FqName, text: String, conservativeRenameSchemeheme: Boolean): String {
    if (!conservativeRenameSchemeheme && !oldPackage.isRoot) return text
    return text.replace(

Response:
("Class\\.forName\\(\"" + oldPackage.child(className.shortName()).asString()).toRegex(),
        "Class.forName(\"" + className.asString()
    )
}

private fun patchRootPartNamesInStrings(
    className: FqName,
    oldPackage: FqName,
    isJvmName: Boolean,
    text: String<|endoftext|>


Prompt:
resolvedCallsAt.joinToString("\n\n", prefix = "$originalText\n\n\n") { (_, resolvedCall) ->
                resolvedCall?.renderToText().toString()
            }

    protected fun extractCarets(text: String): Pair<String, List<Int>> {
        val parts = text.split("<caret>")

Response:
if (parts.size < 2) return text to emptyList()
        // possible to rewrite using 'scan' function to get partial sums of parts lengths
        val indices = mutableListOf<Int>()
        val resultText = buildString {
            parts.dropLast(1).forEach { part ->
                append(part)
                indices.add(this.length)
            }
            append(parts.last())<|endoftext|>


Prompt:
var FirProperty.isReferredViaField: Boolean? by FirDeclarationDataRegistry.data(IsReferredViaField)
var FirProperty.fromPrimaryConstructor: Boolean? by FirDeclarationDataRegistry.data(IsFromPrimaryConstructor)
var FirProperty.componentFunctionSymbol: FirNamedFunctionSymbol? by FirDeclarationDataRegistry.data(ComponentFunctionSymbolKey)

Response:
var FirClassLikeDeclaration.sourceElement: SourceElement? by FirDeclarationDataRegistry.data(SourceElementKey)
var FirRegularClass.moduleName: String? by FirDeclarationDataRegistry.data(ModuleNameKey)

/**
 * @see [FirBasedSymbol.klibSourceFile]
 */
var FirDeclaration.klibSourceFile: SourceFile? by FirDeclarationDataRegistry.data(KlibSourceFile)<|endoftext|>


Prompt: <!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>nj !== j<!>

Response: val test_fnf = <!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>f === nf<!> || <!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>nf === f<!> || <!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>f !== nf<!> ||<|endoftext|>


Prompt:
override fun getDiagnostics(): Diagnostics = storageManager.compute { context.diagnostics }

        override fun <K, V> get(slice: ReadOnlySlice<K, V>, key: K) = storageManager.compute { context.get<K, V>(slice, key) }

Response:
override fun <K, V> getKeys(slice: WritableSlice<K, V>) = storageManager.compute { context.getKeys<K, V>(slice) }

        override fun addOwnDataTo(trace: BindingTrace, commitDiagnostics: Boolean) {
            storageManager.compute { context.addOwnDataTo(trace, commitDiagnostics) }
        }

        @TestOnly<|endoftext|>


Prompt:
if (f != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any?")!>this.f<!>.propNullableAny
        if (f != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any"), DEBUG_INFO_SMARTCAST!>this.f<!>.funT()

Response:
if (f != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any"), DEBUG_INFO_SMARTCAST!>this.f<!>.funAny()
        if (f != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any?")!>this.f<!>.funNullableT()<|endoftext|>


Prompt:
// Built function overrides originalSuperMethod, while, if parent class is already lowered, it would
            // transformedSuperMethod in its declaration list. We need not fake override in that case.
            // Later lowerings will fix it and replace function with one overriding transformedSuperMethod.
            ignoredParentSymbols = listOf(transformedSuperMethod.symbol)
        )

        postprocessCreatedObjectProxy(subclass)

Response:
return subclass
    }

    private fun generateEqualsHashCode(klass: IrClass, superType: IrType, functionDelegateField: IrField) =
        SamEqualsHashCodeMethodsGenerator(context, klass, superType) { receiver ->
            irGetField(receiver, functionDelegateField)
        }.generate()

    private fun getAdditionalSupertypes(supertype: IrType) =<|endoftext|>


Prompt:
}
            }
            candidate.isStatic -> {
                return dispatchReceiverForStatics
            }
            else -> return null
        }
    }

    private fun shouldSkipCandidateWithInconsistentExtensionReceiver(candidate: FirCallableSymbol<*>): Boolean {
        // Pre-check explicit extension receiver for default package top-level members

Response:
if (scope !is FirDefaultStarImportingScope || !areThereExtensionReceiverOptions()) return false

        val declarationReceiverType = candidate.resolvedReceiverTypeRef?.coneType as? ConeClassLikeType ?: return false
        val startProjectedDeclarationReceiverType = declarationReceiverType.lookupTag.constructClassType(<|endoftext|>


Prompt:
if (!(4.toByte() !in charSequence.indices) != range0.contains(4.toByte())) throw AssertionError()
    // no local optimizations
    if (element20 in charSequence.indices != range0.contains(element20)) throw AssertionError()

Response:
if (element20 !in charSequence.indices != !range0.contains(element20)) throw AssertionError()
    if (!(element20 in charSequence.indices) != !range0.contains(element20)) throw AssertionError()
    if (!(element20 !in charSequence.indices) != range0.contains(element20)) throw AssertionError()
}<|endoftext|>


Prompt:
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
     */
    @SinceKotlin("1.9")
    @WasExperimental(ExperimentalStdlibApi::class)
    public operator fun rangeUntil(other: Int): IntRange

    /**
     * Creates a range from this value up to but excluding the specified [other] value.

Response:
*
     * If the [other] value is less than or equal to `this` value, then the returned range is empty.
     */
    @SinceKotlin("1.9")
    @WasExperimental(ExperimentalStdlibApi::class)
    public operator fun rangeUntil(other: Long): LongRange

    /**
     * Shifts this value left by the [bitCount] number of bits.<|endoftext|>


Prompt:
assertConstraint(jvmSourceSet, IdeMultiplatformImport.SourceSetConstraint.isLeaf, isMatchExpected = true)
            assertConstraint(jvmSourceSet, IdeMultiplatformImport.SourceSetConstraint.isNative, isMatchExpected = false)

Response:
assertConstraint(jvmSourceSet, IdeMultiplatformImport.SourceSetConstraint.isSinglePlatformType, isMatchExpected = true)
            assertConstraint(jvmSourceSet, IdeMultiplatformImport.SourceSetConstraint.unconstrained, isMatchExpected = true)
        }

        for (androidSourceSet in listOf(androidMain, androidUnitTest, androidInstrumentedTest)) {<|endoftext|>


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

interface Rec<A: Rec<A, B>, out B>

fun <S> select(vararg args: S): S = TODO()

interface I1
interface I2 : I1
interface I3 : I1
interface I4

Response:
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>

fun testOutOut() {
    val cst1 = select(Obj2, Obj3)
    val cst2 = select(Obj2, Obj4)<|endoftext|>


Prompt: if (<!SENSELESS_COMPARISON!>v != null<!> || <!SENSELESS_COMPARISON!>this.v != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?"), DEBUG_INFO_SMARTCAST!>v<!>.funAny()

Response: if (<!SENSELESS_COMPARISON!>v != null<!> || <!SENSELESS_COMPARISON!>this.v != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>v<!>.funNullableT()<|endoftext|>


Prompt:
"   public class \$\$\$\$\${}\n" +
                "}\n" +
                "\n" +
                "}", "TopLevel")

        assertCanFind(manager, "foo", "TopLevel")

        assertCanFind(manager, "foo", "TopLevel.I\$nner")

Response:
assertCanFind(manager, "foo", "TopLevel.I\$nner.I\$nner")
        assertCanFind(manager, "foo", "TopLevel.I\$nner.\$Inner")
        assertCanFind(manager, "foo", "TopLevel.I\$nner.In\$ne\$r\$")<|endoftext|>


Prompt:
val currentClasspath = reporter.measure(GradleBuildTime.INCREMENTAL_LOAD_CURRENT_CLASSPATH_SNAPSHOT) {
                when (shrinkMode) {
                    is ShrinkMode.ChangedLookupsUnchangedClasspath ->
                        CachedClasspathSnapshotSerializer
                            .load(classpathChanges.classpathSnapshotFiles.currentClasspathEntrySnapshotFiles, reporter)

Response:
.removeDuplicateAndInaccessibleClasses()
                    is ShrinkMode.ChangedLookupsChangedClasspath -> shrinkMode.currentClasspathSnapshot
                }
            }
            val shrunkCurrentClasspathAgainstPrevLookups =<|endoftext|>


Prompt:
import org.jetbrains.kotlin.gradle.util.enableDependencyVerification
import kotlin.test.Test

class WasmDependencyResolutionSmokeTest {

    @Test
    fun `test - project to project ide dependency resolution`() {
        val rootProject = buildProject()
        val consumer = buildProject(projectBuilder = { withName("consumer").withParent(rootProject) })

Response:
val producer = buildProject(projectBuilder = { withName("producer").withParent(rootProject) })

        rootProject.subprojects { project ->
            project.enableDependencyVerification(false)
            project.applyMultiplatformPlugin()
            project.repositories.mavenLocal()
            project.repositories.mavenCentralCacheRedirector()
        }<|endoftext|>


Prompt:
CXCompletionChunk_RightBrace(11),
    CXCompletionChunk_LeftAngle(12),
    CXCompletionChunk_RightAngle(13),
    CXCompletionChunk_Comma(14),
    CXCompletionChunk_ResultType(15),
    CXCompletionChunk_Colon(16),

Response:
CXCompletionChunk_SemiColon(17),
    CXCompletionChunk_Equal(18),
    CXCompletionChunk_HorizontalSpace(19),
    CXCompletionChunk_VerticalSpace(20),
    ;

    companion object {

        @Deprecated("Will be removed.", ReplaceWith(""), DeprecationLevel.WARNING)<|endoftext|>


Prompt:
class Case3() : I {
    companion object  {
        operator fun invoke(x1: ()->CharSequence, x2: Any = ""): Unit = print(3) // (3)
        operator fun invoke(y1: ()->CharSequence, y2: String = ""): Any { print(4); return "" } // (4)
    }

    val x = ""

Response:
fun x() = "" as CharSequence

    fun case() {
        I.<!OVERLOAD_RESOLUTION_AMBIGUITY!>invoke<!>(::<!OVERLOAD_RESOLUTION_AMBIGUITY!>x<!>)<|endoftext|>


Prompt:
* strong reference to the `LLFirSession`. See the documentation of [LLFirSession][org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSession]
 * for more information.
 */
@OptIn(KtAnalysisApiInternals::class, KtAnalysisNonPublicApi::class)
@Suppress("AnalysisApiMissingLifetimeCheck")

Response:
internal class KtFirAnalysisSession
private constructor(
    val project: Project,
    val firResolveSession: LLFirResolveSession,
    token: KtLifetimeToken,
) : KtAnalysisSession(token) {

    internal val firSymbolBuilder: KtSymbolByFirBuilder = KtSymbolByFirBuilder(project, this, token)<|endoftext|>


Prompt:
exitCodeCheck = TestRunCheck.ExitCode.Expected(0).takeUnless { isExpectedFailure },
                fileCheckMatcher = fileCheckStage?.let { TestRunCheck.FileCheckMatcher(settings, testDataFile) }
            ),
            fileCheckStage = fileCheckStage,
            extras = WithTestRunnerExtras(runnerType = TestRunnerType.DEFAULT)
        )

Response:
testCase.initialize(
            givenModules = customKlibs.klibs.mapToSet(TestModule::Given),
            findSharedModule = sharedModules::get
        )

        return testCase
    }

    private fun retrieveFileCheckStage(): String? {
        val fileCheckStages = structure.directives.multiValues(FILECHECK_STAGE.name)<|endoftext|>


Prompt:
private fun <T> Array<T>.subarrayContentEquals(offset: Int, length: Int, other: List<*>): Boolean {
    if (length != other.size) return false
    var i = 0
    while (i < length) {
        if (this[offset + i] != other[i]) return false
        i++
    }
    return true
}

Response:
internal fun <T> Array<T>.copyOfUninitializedElements(newSize: Int): Array<T> {
    @Suppress("UNCHECKED_CAST")
    return copyOf(newSize) as Array<T>
}

internal fun <E> Array<E>.resetAt(index: Int) {
    @Suppress("UNCHECKED_CAST")<|endoftext|>


Prompt:
assertSame(projectB.projectNameProperty, projectB.projectNameProperty)
    }

    @Test
    fun `test - counterProperty`() {
        val projectA = buildProject()
        val projectB = buildProject()

        assertEquals(Value(0), projectA.counterProperty)
        assertEquals(Value(0), projectA.counterProperty)

Response:
assertEquals(Value(1), projectB.counterProperty)
        assertEquals(Value(1), projectB.counterProperty)
    }

    @Test
    fun `test - Scope`() {
        val project = buildProject()
        val scopeA = Scope("a")
        val scopeB = Scope("b")

        with(scopeA) {<|endoftext|>


Prompt:
override val meta: StubContainerMeta = StubContainerMeta(),
        override val classes: List<ClassStub> = emptyList(),
        override val functions: List<FunctionalStub> = emptyList(),
        override val properties: List<PropertyStub> = emptyList(),
        override val typealiases: List<TypealiasStub> = emptyList(),

Response:
override val simpleContainers: List<SimpleStubContainer> = emptyList()
) : StubContainer() {

    override fun <T, R> accept(visitor: StubIrVisitor<T, R>, data: T): R {
        return visitor.visitSimpleStubContainer(this, data)
    }
}

val StubContainer.children: List<StubIrElement><|endoftext|>


Prompt:
val prev = value.nextDown()
            if (prev > 0) {
                assertEquals(value, prev + prev.ulp)
            } else {
                assertEquals(prev, value - value.ulp)
            }

            val toZero = value.nextTowards(0.0)
            if (toZero != 0.0) {

Response:
assertEquals(value, toZero + toZero.ulp.withSign(toZero))
            }

            assertEquals(Double.POSITIVE_INFINITY, Double.MAX_VALUE.nextUp())
            assertEquals(Double.MAX_VALUE, Double.POSITIVE_INFINITY.nextDown())<|endoftext|>


Prompt:
reportSourceSetCommonizerDependencies {
                val nativeMain = getCommonizerDependencies("nativeMain")
                val konanDataDirProperty = buildOptions.konanDataDir
                    ?: error("konanDataDir must not be null in this test. Please set a custom konanDataDir property.")

Response:
nativeMain.withoutNativeDistributionDependencies(konanDataDirProperty).assertDependencyFilesMatches(".*cinterop-dummy")
                nativeMain.onlyNativeDistributionDependencies(konanDataDirProperty).assertNotEmpty()
                nativeMain.assertTargetOnAllDependencies(CommonizerTarget(LINUX_X64, LINUX_ARM64, MINGW_X64))<|endoftext|>


Prompt:
fun `test typealias and class`() {
        val result = commonize {
            outputTarget("(a,b)")
            simpleSingleSourceTarget("a", """class X """)
            simpleSingleSourceTarget(
                "b", """
                class B
                typealias X = B
                """
            )
        }

        result.assertCommonized("(a,b)", "expect class X()")

Response:
}

    fun `test typealias to different classes`() {
        val result = commonize {
            outputTarget("(a, b)", "(c, d)", "(e, f)", "(a, b, c, d)", "(a, b, c, d, e, f)")
            simpleSingleSourceTarget(
                "a", """
                class AB
                typealias x = AB
            """
            )<|endoftext|>


Prompt:
val jarB = tmp.newFile("inputB.jar").also { jar ->
            ZipOutputStream(jar.outputStream()).use {
                it.putNextEntry(ZipEntry("test/B.class"))
                it.write(emptyClass("test/B"))
                it.closeEntry()

                it.putNextEntry(ZipEntry("test/A.class"))

Response:
it.write(emptyClass("test/A"))
                it.closeEntry()
            }
        }
        val outputsB = TransformOutputsMock(tmp.newFolder())
        transform(jarB, outputsB)

        assertArrayEquals(outputsA.createdOutputs.single().readBytes(), outputsB.createdOutputs.single().readBytes())
    }

    @Test<|endoftext|>


Prompt:
KotlinBuildStatsMXBean {

    override fun report(metric: BooleanMetrics, value: Boolean, subprojectName: String?, weight: Long?): Boolean =
        report(kotlinBuildLogger.sessionLogger, metric, value, subprojectName, weight)

Response:
override fun report(metric: NumericalMetrics, value: Long, subprojectName: String?, weight: Long?): Boolean =
        report(kotlinBuildLogger.sessionLogger, metric, value, subprojectName, weight)

    override fun report(metric: StringMetrics, value: String, subprojectName: String?, weight: Long?): Boolean =<|endoftext|>


Prompt:
override fun getListOfAcceptableFunctions(): List<String> {
        return listOf("kotlin.internal.ir.dataClassArrayMemberToString")
    }

    private fun arrayToString(array: Any?): String {
        return when (array) {
            null -> "null"
            is Array<*> -> Arrays.toString(array)

Response:
is ByteArray -> Arrays.toString(array)
            is ShortArray -> Arrays.toString(array)
            is IntArray -> Arrays.toString(array)
            is LongArray -> Arrays.toString(array)
            is CharArray -> Arrays.toString(array)
            is BooleanArray -> Arrays.toString(array)
            is FloatArray -> Arrays.toString(array)<|endoftext|>


Prompt:
private fun checkOnlyInputTypes(bounds: Collection<Bound>, possibleAnswer: KotlinType): Boolean {
        if (!typeVariable.hasOnlyInputTypesAnnotation()) return true

        // Only type mentioned in bounds might be the result
        val typesInBoundsSet =

Response:
bounds.filter { it.isProper && it.constrainingType.constructor.isDenotable }.map { it.constrainingType }.toSet()
        // Flexible types are equal to inflexible
        if (typesInBoundsSet.any { KotlinTypeChecker.DEFAULT.equalTypes(it, possibleAnswer) }) return true<|endoftext|>


Prompt:
package org.jetbrains.kotlin.js.inline

import org.jetbrains.kotlin.descriptors.PropertyGetterDescriptor
import org.jetbrains.kotlin.descriptors.PropertySetterDescriptor
import org.jetbrains.kotlin.js.backend.ast.*

Response:
import org.jetbrains.kotlin.js.backend.ast.metadata.descriptor
import org.jetbrains.kotlin.js.backend.ast.metadata.forcedReturnVariable
import org.jetbrains.kotlin.js.backend.ast.metadata.isInline
import org.jetbrains.kotlin.js.backend.ast.metadata.psiElement<|endoftext|>


Prompt:
fun TestFile.toLightTreeShortName() = name.substringAfterLast('/').substringAfterLast('\\')

fun SourceFileProvider.getKtSourceFilesForSourceFiles(
    testFiles: Collection<TestFile>,
): Map<TestFile, KtSourceFile> {
    return testFiles.mapNotNull {
        if (!it.isKtFile) return@mapNotNull null

Response:
val shortName = it.toLightTreeShortName()
        val ktSourceFile = KtInMemoryTextSourceFile(shortName, "/$shortName", getContentOfSourceFile(it))
        it to ktSourceFile
    }.toMap()
}

val TestFile.isKtFile: Boolean
    get() = name.endsWith(".kt") || name.endsWith(".kts")<|endoftext|>


Prompt:
val isClass: Boolean,
    val canHaveSubtypesAccordingToK1: Boolean,
) {
    override fun toString() = "$type"
}

private val FirClassSymbol<*>.isBuiltin get() = isPrimitiveType() || classId == StandardClassIds.String || isEnumClass

Response:
internal val TypeInfo.isNullableEnum get() = isEnumClass && type.isNullable

internal val TypeInfo.isIdentityLess get() = isPrimitive || isValueClass

internal val TypeInfo.isNotNullPrimitive get() = isPrimitive && !type.isNullable

private val FirClassSymbol<*>.isFinalClass get() = isClass && isFinal<|endoftext|>


Prompt:
public actual fun <T : Comparable<T>> maxOf(a: T, b: T, c: T): T {
    return maxOf(a, maxOf(b, c))
}

/**
 * Returns the greater of three values.
 */
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly

Response:
public actual inline fun maxOf(a: Byte, b: Byte, c: Byte): Byte {
    return JsMath.max(a.toInt(), b.toInt(), c.toInt()).unsafeCast<Byte>()
}

/**
 * Returns the greater of three values.
 */
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly<|endoftext|>


Prompt:
// NATIVE error: name contains illegal characters: "$"
// IGNORE_BACKEND: NATIVE
// WITH_STDLIB

import kotlin.reflect.KClass
import kotlin.test.assertEquals

fun check(klass: KClass<*>, expectedName: String) {
    assertEquals(expectedName, klass.simpleName)
}

fun localInMethod() {

Response:
fun localInMethod(unused: Any?) {
        class Local
        check(Local::class, "Local")

        class `Local$With$Dollars`
        check(`Local$With$Dollars`::class, "Local\$With\$Dollars")
    }
    localInMethod(null)

    class Local
    check(Local::class, "Local")<|endoftext|>


Prompt:
if (signature != null) {
            proto.setExtension(JvmProtoBuf.propertySignature, signature)
        }

        if (property.isJvmFieldPropertyInInterfaceCompanion() && versionRequirementTable != null) {
            proto.setExtension(JvmProtoBuf.flags, JvmFlags.getPropertyFlags(true))
        }

Response:
if (getter?.needsInlineParameterNullCheckRequirement() == true || setter?.needsInlineParameterNullCheckRequirement() == true) {
            versionRequirementTable?.writeInlineParameterNullCheckRequirement(proto::addVersionRequirement)
        }
    }

    private fun FirProperty.isJvmFieldPropertyInInterfaceCompanion(): Boolean {<|endoftext|>


Prompt:
* or a positive number if it's greater than other.
     */
    @kotlin.internal.IntrinsicConstEvaluation
    public operator fun compareTo(other: Float): Int

    /**
     * Compares this value with the specified value for order.
     * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,

Response:
* or a positive number if it's greater than other.
     */
    @kotlin.internal.IntrinsicConstEvaluation
    public override operator fun compareTo(other: Double): Int

    /** Adds the other value to this value. */
    @kotlin.internal.IntrinsicConstEvaluation
    public operator fun plus(other: Byte): Double<|endoftext|>


Prompt:
import org.jetbrains.jps.model.module.JpsModuleSourceRootType

sealed class KotlinSourceRootType() : JpsElementTypeBase<JavaSourceRootProperties>(), JpsModuleSourceRootType<JavaSourceRootProperties> {

    override fun createDefaultProperties() = JpsJavaExtensionService.getInstance().createSourceRootProperties("")

}

Response:
object SourceKotlinRootType : KotlinSourceRootType()

object TestSourceKotlinRootType : KotlinSourceRootType() {
    override fun isForTests() = true
}

val ALL_KOTLIN_SOURCE_ROOT_TYPES = setOf(SourceKotlinRootType, TestSourceKotlinRootType)<|endoftext|>


Prompt:
final override val fqName: FqName
) : DeclarationDescriptorNonRootImpl(module, Annotations.EMPTY, fqName.shortNameOrSpecial(), SourceElement.NO_SOURCE),
        PackageFragmentDescriptor {
    // Not inlined in order to not capture ref on 'module'
    private val debugString: String = "package $fqName of $module"

Response:
override fun <R, D> accept(visitor: DeclarationDescriptorVisitor<R, D>, data: D): R =
            visitor.visitPackageFragmentDescriptor(this, data)

    override fun getContainingDeclaration(): ModuleDescriptor {
        return super.getContainingDeclaration() as ModuleDescriptor
    }

    override fun getSource(): SourceElement {<|endoftext|>


Prompt:
// FILE: jvm.kt
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.CLASS)
actual annotation class ExpectIsSubsetOfActual

@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.CLASS)

Response:
actual annotation class ExpectIsSubsetOfActualDifferentOrder

@Target(AnnotationTarget.FUNCTION)
actual annotation class MoreTargetsOnExpect

@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS, AnnotationTarget.TYPEALIAS)
actual annotation class RepeatedTargetsInExpect

@Target(AnnotationTarget.FUNCTION)
actual annotation class EmptyTargetsActual<|endoftext|>


Prompt:
Double.fromBits(0x0010000000000000) to 2.812644285236262E-103, // smallest normal value
            Double.fromBits(0x1L) to 1.7031839360032603E-108, // smallest value (denormal)
            Double.MAX_VALUE to 5.643803094122362E102,
            0.0 to 0.0,

Response:
0.9 to 0.9654893846056297,
            9.9 to 2.1472291690189413,
            27.0 to 3.0,
            399.1289 to 7.362710510208026,
            8123.452 to 20.102351976782558,
            21717.639 to 27.9,<|endoftext|>


Prompt:
val arr = IntArray(5)
        arr[1] = 1
        arr[3] = -1
        assertEquals(1, arr[1])
        assertEquals(-1, arr[3])
    }

    @Test fun longArraySet() {
        val arr = LongArray(5)
        arr[1] = 1
        arr[3] = -1

Response:
assertEquals(1, arr[1])
        assertEquals(-1, arr[3])
    }

    @Test fun arrayGetOutOfBounds() {
        val arr = Array<Any?>(5) { null }
        assertFailsWith<IndexOutOfBoundsException> {
            arr[arr.size]
        }
        assertFailsWith<IndexOutOfBoundsException> {<|endoftext|>


Prompt:
expression2MfvcNodeInstanceAccessor[setterExpressions] = MfvcNodeInstanceAccessor.Setter(instance, values)
            +setterExpressions
            return setterExpressions
        }

        fun IrBlockBuilder.addReplacement(expression: IrCall): IrExpression? {
            val function = expression.symbol.owner

Response:
val property = function.property?.takeIf { function.isGetter } ?: return null
            val dispatchReceiver = expression.dispatchReceiver
            dispatchReceiver?.get(this, property.name)?.let { +it; return it }
            val node = replacements.getMfvcPropertyNode(property) ?: return null
            val typeArguments = makeTypeArgumentsFromFunction(expression)<|endoftext|>


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

Response:
if (!(1.toByte() in 1L..3L) != !range0.contains(1.toByte())) throw AssertionError()
    if (!(1.toByte() !in 1L..3L) != range0.contains(1.toByte())) throw AssertionError()
    // no local optimizations<|endoftext|>


Prompt:
// WITH_STDLIB
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract

@OptIn(ExperimentalContracts::class)
fun returnsNullContract(foo: Any?): Any? {

Response:
contr<caret>act {
        returns(null) implies (foo == null)
    }
    return foo
}<|endoftext|>


Prompt:
* Returns the [KClass] instance representing the runtime class to which this type is erased to on JVM.
 */
@SinceKotlin("1.1")
val KType.jvmErasure: KClass<*>
    get() = classifier?.jvmErasure ?: throw KotlinReflectionInternalError("Cannot calculate JVM erasure for type: $this")

Response:
internal val KClassifier.jvmErasure: KClass<*>
    get() = when (this) {
        is KClass<*> -> this
        is KTypeParameter -> {
            // See getRepresentativeUpperBound in typeSignatureMapping.kt
            val bounds = upperBounds
            val representativeBound = bounds.firstOrNull {<|endoftext|>


Prompt:
// LANGUAGE: +MultiPlatformProjects
// ISSUE: KT-66960

// MODULE: common
// FILE: common.kt
expect sealed class Base()

class CommonDerived : Base()

// should be an error
fun commonTest(x: Base) = <!NO_ELSE_IN_WHEN!>when<!> (x) {
    is CommonDerived -> 1
}

Response:
// MODULE: main()()(common)
// FILE: test.kt
actual typealias Base = PlatformBase

sealed class PlatformBase

class PlatformDerived : PlatformBase()

// should be ok
fun platformTest_1(x: Base) = when (x) {
    is CommonDerived -> 1
    is PlatformDerived -> 2
}

// should be an error<|endoftext|>


Prompt:
forConstructorHeaders: FirTowerDataContext? = null,
        forEnumEntries: FirTowerDataContext? = null,
        primaryConstructorPureParametersScope: FirLocalScope? = null,
        primaryConstructorAllParametersScope: FirLocalScope? = null,
    ) : this(

Response:
enumMap(regular, forClassHeaderAnnotations, forNestedClasses, forCompanionObject, forConstructorHeaders, forEnumEntries),
        primaryConstructorPureParametersScope,
        primaryConstructorAllParametersScope,
        FirTowerDataMode.REGULAR
    )

    val currentContext: FirTowerDataContext?
        get() = modeMap[activeMode]<|endoftext|>


Prompt:
arguments: List<IrTypeArgument>,
            erasedParameters: MutableSet<IrTypeParameterSymbol>?,
            leaveNonReifiedAsIs: Boolean,
        ) =
            arguments.memoryOptimizedMap { argument ->
                (argument as? IrTypeProjection)?.let { proj ->

Response:
remapType(proj.type, erasedParameters, leaveNonReifiedAsIs)?.let { newType ->
                        makeTypeProjection(newType, proj.variance)
                    } ?: IrStarProjectionImpl
                }
                    ?: argument
            }

        override fun remapType(type: IrType) = remapType(type, defaultNonReifiedTypeParameterRemappingMode)<|endoftext|>


Prompt:
val list4 = ArrayList<Long>()
    val range4 = (MaxL - 2).toLong()..MaxL
    for (i in range4) {
        list4.add(i)
        if (list4.size > 23) break
    }
    if (list4 != listOf<Long>((MaxL - 2).toLong(), (MaxL - 1).toLong(), MaxL)) {

Response:
return "Wrong elements for (MaxL - 2).toLong()..MaxL: $list4"
    }

    val list5 = ArrayList<Char>()
    val range5 = (MaxC - 2)..MaxC
    for (i in range5) {
        list5.add(i)
        if (list5.size > 23) break
    }<|endoftext|>


Prompt:
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?)

Response:
// CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append
// CHECK-OPT: %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_generated.Foo#toString(){}kotlin.String"<|endoftext|>


Prompt:
because there are no ${f.element.pluralize()} in it that _do not_ match the predicate.
            See a more detailed explanation of this logic concept in ["Vacuous truth"](https://en.wikipedia.org/wiki/Vacuous_truth) article.
            """
        }
        sample("samples.collections.Collections.Aggregates.all")
        returns("Boolean")

Response:
body {
            """
            ${when (f) {
                Iterables -> "if (this is Collection && isEmpty()) return true"
                Maps -> "if (isEmpty()) return true"
                else -> ""
            }}
            for (element in this) if (!predicate(element)) return false
            return true
            """
        }
    }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyAccessor
import org.jetbrains.kotlin.fir.declarations.utils.*
import org.jetbrains.kotlin.fir.expressions.*

Response:
import org.jetbrains.kotlin.fir.references.FirThisReference
import org.jetbrains.kotlin.fir.references.symbol
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.resolve.toSymbol<|endoftext|>


Prompt: 0x401d8e64b8d4ddaeUL,     0x3ff48b5e3c3e8186UL,     0x404b4c902e273a58UL,     0x3fd78b56362cef38UL,

Response:
0x3fd78b56362df217UL,     0x3fd78b56362bec59UL,     0x3fe368b2fc6f960aUL,     0x3fc152aaa3bf81ccUL,
            0x3fe8ebef9eac820bUL,     0x3f92c155b8213cf4UL,
        )<|endoftext|>


Prompt:
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns(true).let { it implies (x is Number) }<!> // 'ConditionalEffect' as result
    }
    return x is Number
}

// TESTCASE NUMBER: 5
fun case_5(x: Any?): Boolean {
    contract {

Response:
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns(true).run { implies (x is Number) }<!> // 'ConditionalEffect' as result
    }
    return x is Number
}

// TESTCASE NUMBER: 6
fun case_6(x: Any?): Boolean {
    contract {<|endoftext|>


Prompt:
}

        val size = expression.valueArgumentsCount

        for (i in 0 until size) {
            val argument = expression.getValueArgument(i)
            val parameter = expression.symbol.owner.valueParameters[i]
            val varargElementType = parameter.varargElementType
            if (argument == null && varargElementType != null) {

Response:
val arrayInfo = InlineClassArrayInfo(context, varargElementType, parameter.type)
                val emptyArray = with(arrayInfo) {
                    boxArrayIfNeeded(toPrimitiveArrayLiteral(emptyList()))
                }

                expression.putValueArgument(i, emptyArray)
            }
        }

        return expression
    }
}<|endoftext|>


Prompt:
// WITH_STDLIB

class C {
    var x: Int = 0
}

fun test(с: C?, a: Any) {
    с?.x = if (a is String) 0 else throw Exception();
    a.<!UNRESOLVED_REFERENCE!>toUpperCase<!>()
}

fun main(args: Array<String>) {
    test(null, 1)

Response: }<|endoftext|>


Prompt:
if (irBranches.size == 1) {
            val irBranch0 = irBranches[0]
            return buildStatement(ktIf.startOffsetSkippingComments, ktIf.endOffset) {
                irIfThenMaybeElse(resultType, irBranch0.condition, irBranch0.result, irElseResult, IrStatementOrigin.IF)
            }
        }

Response:
val irWhen = IrWhenImpl(ktIf.startOffsetSkippingComments, ktIf.endOffset, resultType, IrStatementOrigin.IF)

        irWhen.branches.addAll(irBranches)

        irElseResult?.let {
            irWhen.branches.add(elseBranch(it))
        }

        return irWhen
    }<|endoftext|>


Prompt:
var x: Any = materialize()
    exactlyOnce {
        while (x is String) {
            <!SMARTCAST_IMPOSSIBLE!>x<!>.length
            x = 10
        }
    }
}

fun test47() {
    var x: Any = materialize()
    atLeastOnce {
        while (x is String) {

Response:
<!SMARTCAST_IMPOSSIBLE!>x<!>.length
            x = 10
        }
    }
}

fun test48() {
    var x: Any = materialize()
    runWithoutContract {
        while (x is String) {
            <!SMARTCAST_IMPOSSIBLE!>x<!>.length
            x = 10
        }
    }
}<|endoftext|>


Prompt:
val incrementalDataOutputDir = options.incrementalDataOutputDir ?: return

        val reportOutputFiles = kaptContext.generationState.configuration.getBoolean(CommonConfigurationKeys.REPORT_OUTPUT_FILES)
        kaptContext.generationState.factory.writeAll(
            incrementalDataOutputDir,

Response:
if (!reportOutputFiles) null else fun(sources: List<File>, output: File) {
                messageCollector.report(OUTPUT, OutputMessageUtil.formatOutputMessage(sources, output))
            }
        )
    }

    protected abstract fun loadProcessors(): LoadedProcessors
}

inline fun <T> measureTimeMillis(block: () -> T): Pair<Long, T> {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
import org.jetbrains.kotlin.load.kotlin.MemberSignature
import org.jetbrains.kotlin.load.kotlin.getPropertySignature
import org.jetbrains.kotlin.metadata.ProtoBuf

Response:
import org.jetbrains.kotlin.metadata.deserialization.*
import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmFlags
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil<|endoftext|>


Prompt:
origin = origin
        )
    }

    private fun createFakeBridgeBuilderResult(
            fqName: String,
            namesToBeDeclared: List<String>
    ): BridgeBuilderResult {
        val nativeBridges = object : NativeBridges {
            override fun isSupported(nativeBacked: NativeBacked): Boolean = true

Response:
override val kotlinLines: Sequence<String> = emptySequence()
            override val nativeLines: Sequence<String> = emptySequence()
        }
        val kotlinFile = object : KotlinFile(fqName, namesToBeDeclared) {
            override val mappingBridgeGenerator: MappingBridgeGenerator
                get() = error("Not needed for tests.")
        }<|endoftext|>


Prompt:
private val guardToLoopLabel = mutableMapOf<JsName, JsName?>()

    fun apply(): Boolean {
        analyze()
        perform()
        return hasChanges
    }

    private fun analyze() {
        object : RecursiveJsVisitor() {
            override fun visitLabel(x: JsLabel) {
                val statement = x.statement

Response:
if (statement is JsDoWhile) {
                    processDoWhile(statement, x.name)
                }
                else {
                    super.visitLabel(x)
                }
            }

            override fun visitDoWhile(x: JsDoWhile) = processDoWhile(x, null)

            private fun processDoWhile(x: JsDoWhile, label: JsName?) {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.resolve.calls.components.CheckVisibility
import org.jetbrains.kotlin.resolve.calls.components.CollectionTypeVariableUsagesInfo
import org.jetbrains.kotlin.resolve.calls.components.CompatibilityOfPartiallyApplicableSamConversion

Response:
import org.jetbrains.kotlin.resolve.calls.components.CreateFreshVariablesSubstitutor
import org.jetbrains.kotlin.resolve.calls.components.EagerResolveOfCallableReferences
import org.jetbrains.kotlin.resolve.calls.components.MapArguments<|endoftext|>


Prompt:
* Structural changes in the base list are synchronized with the view, and vice verse.
     */
    @ExperimentalJsExport
    @ExperimentalJsCollectionsApi
    @SinceKotlin("2.0")
    public fun asJsArrayView(): JsArray<E> = createJsArrayViewFrom(this)
}

/**
 * A generic unordered collection of elements that does not support duplicate elements.

Response:
* Methods in this interface support only read-only access to the set;
 * read/write access is supported through the [MutableSet] interface.
 * @param E the type of elements contained in the set. The set is covariant in its element type.
 */
public interface Set<out E> : Collection<E> {
    // Query Operations

    override val size: Int

    override fun isEmpty(): Boolean<|endoftext|>


Prompt: $i$a$-foo-LibraryKt$flaf$1\3\60\1:int=0:int, x\3:int=1:int

Response: // library.kt:5 box: $i$f$flaf\1\27:int=0:int, flafVar\1:int=0:int, fooParam\2:int=0:int, $i$f$foo\2\58:int=0:int, fooVar\2:int=0:int, it\3:int=42:int,<|endoftext|>


Prompt:
ProperArrayConventionSetterWithDefaultCalls(KOTLIN_1_5, kind = OTHER),
    AdaptedCallableReferenceAgainstReflectiveType(null),
    InferenceCompatibility(KOTLIN_1_5, kind = BUG_FIX),
    RequiredPrimaryConstructorDelegationCallInEnums(KOTLIN_1_5, kind = BUG_FIX),

Response:
ApproximateAnonymousReturnTypesInPrivateInlineFunctions(KOTLIN_1_5, kind = BUG_FIX),
    ForbidReferencingToUnderscoreNamedParameterOfCatchBlock(KOTLIN_1_5, kind = BUG_FIX),
    UseCorrectExecutionOrderForVarargArguments(KOTLIN_1_5, kind = BUG_FIX),<|endoftext|>


Prompt:
class TestAcceptedAnnotationsAsyncResolver : AsyncDependenciesResolver, AcceptedAnnotationsCheck {
    @AcceptedAnnotations(TestAnno1::class, TestAnno3::class)
    override suspend fun resolveAsync(scriptContents: ScriptContents, environment: Environment): ResolveResult {
        return checkHasAnno1Annotation(scriptContents)
    }
}

Response:
class TestAcceptedAnnotationsLegacyResolver : ScriptDependenciesResolver, AcceptedAnnotationsCheck {
    @AcceptedAnnotations(TestAnno1::class, TestAnno3::class)
    override fun resolve(
        script: ScriptContents,
        environment: Environment?,
        report: (ScriptDependenciesResolver.ReportSeverity, String, ScriptContents.Position?) -> Unit,<|endoftext|>


Prompt:
* In order to go backwards the [step] must be negative.
         *
         * [step] must be greater than `Int.MIN_VALUE` and not equal to zero.
         */
        public fun fromClosedRange(rangeStart: Int, rangeEnd: Int, step: Int): IntProgression = IntProgression(rangeStart, rangeEnd, step)
    }
}

/**

Response:
* A progression of values of type `Long`.
 */
public open class LongProgression
    internal constructor
    (
            start: Long,
            endInclusive: Long,
            step: Long
    ) : Iterable<Long> {
    init {
        if (step == 0L) throw kotlin.IllegalArgumentException("Step must be non-zero.")<|endoftext|>


Prompt:
this.isConst -> FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE
                else -> FirResolvePhase.BODY_RESOLVE
            }
            lazyResolveToPhase(requiredPhase)
            return fir.initializer
        }

    val resolvedDefaultValue: FirExpression?
        get() {
            val valueParameter = fir as? FirValueParameter

Response:
if (valueParameter?.defaultValue == null) return null

            lazyResolveToPhase(FirResolvePhase.BODY_RESOLVE)
            return valueParameter.defaultValue
        }
}

open class FirPropertySymbol(callableId: CallableId, ) : FirVariableSymbol<FirProperty>(callableId), PropertySymbolMarker {<|endoftext|>


Prompt:
pipelineType = testRunSettings.get(),
            dependencies = moduleDependencies.map {
                if (useHeaders) it.klibFile.toHeaderCacheArtifact().toDependency() else it.klibFile.toStaticCacheArtifact().toDependency()
            } + klib.toKlib().toDependency(),
            expectedArtifact = klib.toStaticCacheArtifact()

Response:
)

        compilation.trigger()
    }

    private inner class LightDependencyWithVersion(
        val name: String, val version: Int
    ) {
        val module: TestModule.Exclusive = TestModule.Exclusive(
            name = name,
            directDependencySymbols = emptySet(),
            directFriendSymbols = emptySet(),<|endoftext|>


Prompt:
/** Computes the sine of the angle [x] given in radians.
 *
 *  Special cases:
 *   - `sin(NaN|+Inf|-Inf)` is `NaN`
 */
@SinceKotlin("1.2")
@GCUnsafeCall("Kotlin_math_sinf")
external public actual fun sin(x: Float): Float

Response:
/** Computes the cosine of the angle [x] given in radians.
 *
 *  Special cases:
 *   - `cos(NaN|+Inf|-Inf)` is `NaN`
 */
@SinceKotlin("1.2")
@GCUnsafeCall("Kotlin_math_cosf")
external public actual fun cos(x: Float): Float<|endoftext|>


Prompt:
equal(lam2, { (genericFakeOverride as GenericMFVCHolderWithImpls<DPoint>).p = dPoint })
    equal(lam4, { genericFakeOverride.p1 = dPoint })
    equal(lam4, { (genericFakeOverride as GenericMFVCHolderWithImpls<DPoint>).p1 = dPoint })
    equal(lam10, { reifiedFakeOverride.p = dPoint })

Response:
equal(lam10, { (reifiedFakeOverride as ReifiedMFVCHolderWithImpls).p = dPoint })
    equal(lam12, { reifiedFakeOverride.p1 = dPoint })
    equal(lam12, { (reifiedFakeOverride as ReifiedMFVCHolderWithImpls).p1 = dPoint })<|endoftext|>


Prompt:
internal inline fun withLogFile(prefix: String, suffix: String = ".log", printLogOnException: Boolean = true, body: (File) -> Unit) {
    val logFile = FileUtil.createTempFile(prefix, suffix)
    try {
        body(logFile)
    }
    catch (e: Exception) {
        if (printLogOnException) {

Response:
Thread.sleep(100) // trying to wait log flushing
            System.err.println("--- log file ${logFile.name}:\n${logFile.readText()}\n---")
        }
        throw e
    }
}

// java.util.Logger used in the daemon silently forgets to log into a file specified in the config on Windows,<|endoftext|>


Prompt: <!CONFLICTING_OVERLOADS!>open fun <T: UserInterfaceB> testTypeParameterWithMultipleShuffledUpperBoundsBB(arg: T)<!> where T: UserInterfaceA {}

Response: <!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) open fun <T: UserInterfaceA> testTypeParameterWithMultipleShuffledUpperBoundsBC(arg: Invariant<T>)<!> where T: UserInterfaceB {}<|endoftext|>


Prompt:
if (isVarargs && this.javaClass == Array<Any?>::class.java)
    // if the array came from varargs and already is array of Any, copying isn't required
        @Suppress("UNCHECKED_CAST") (this as Array<Any?>)
    else
        java.util.Arrays.copyOf(this, this.size, Array<Any?>::class.java)

Response:
@PublishedApi
@SinceKotlin("1.3")
@InlineOnly
internal actual inline fun checkIndexOverflow(index: Int): Int {
    if (index < 0) {
        if (apiVersionIsAtLeast(1, 3, 0))
            throwIndexOverflow()
        else
            throw ArithmeticException("Index overflow has happened.")
    }
    return index
}

@PublishedApi<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>inv<!>()
    }
}

/*
 * TESTCASE NUMBER: 2

Response:
* UNEXPECTED BEHAVIOUR
 * ISSUES: KT-29935
 */
fun case_2(x: Int?) {
    if (x != @RetentionSourceAndTargetExpression null == true) {
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!><|endoftext|>


Prompt:
dir.findChild(fileName)?.takeIf(VirtualFile::isValid)
        }?.takeIf { it in scope }

    private fun findSigFileIfEnabled(
        dir: VirtualFile,
        simpleName: String
    ) = if (enableSearchInCtSym) dir.findChild("$simpleName.sig") else null

Response:
private fun findBinaryOrSigClass(classId: ClassId, simpleName: String, rootType: Set<JavaRoot.RootType>) =
        index.findClass(classId, acceptedRootTypes = rootType) { dir, _ ->
            val file = dir.findChild("$simpleName.class") ?: findSigFileIfEnabled(dir, simpleName)<|endoftext|>


Prompt:
class A {
    val lambda: () -> Unit = TODO()
    val memberInvoke: B = TODO()
    val extensionInvoke: C = TODO()
}

class B {
    operator fun invoke() {}
}

class C
operator fun C.invoke() {}

fun test(a: A?) {

Response:
a?.<!UNSAFE_IMPLICIT_INVOKE_CALL!>lambda<!>()
    a?.<!UNSAFE_IMPLICIT_INVOKE_CALL!>memberInvoke<!>()
    a?.extensionInvoke()
}<|endoftext|>


Prompt:
interface In<in E>

class En<T> : In<T>
class A : In<A>
fun <T> select(x: T, y: T): T = x ?: y

// This test just checks that no internal error happens in backend
// Return type should be In<*> nor In<out Any?>
fun foobar(e: En<*>) = select(A(), e)

Response: fun box() = "OK"<|endoftext|>


Prompt:
assertTrue(file.isDirectory, "$name is not directory, only directories should be left")
                assertFalse(namesTopDownLeave.contains(name), "$name is left twice")
                namesTopDownLeave.add(name)
                assertTrue(namesTopDownEnter.contains(name), "$name is left before entrance")
            }

            fun visit(file: File) {

Response:
val name = file.relativeToOrSelf(basedir).invariantSeparatorsPath
                if (file.isDirectory) {
                    assertTrue(namesTopDownEnter.contains(name), "$name is visited before entrance")
                    namesTopDown.add(name)
                    assertFalse(namesTopDownLeave.contains(name), "$name is visited after leaving")
                }
                if (file == basedir)<|endoftext|>


Prompt:
fun foo(total: String) = 10

fun <T> id(x: T) = x

fun main() {
    var newValue = A()
    newValue <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> id { total -> A() }
    newValue <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> id(fun(total) = A())

Response:
newValue <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> id(fun(total): A { return A() })
    newValue <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> id(::foo)
}<|endoftext|>


Prompt:
assertFalse(eqByteDoubleQ(1.toByte(), 0.toDouble()))
    assertTrue(eqByteDoubleQ(1.toByte(), 1.toDouble()))
    assertFalse(eqByteDoubleQ(1.toByte(), null))
    assertFalse(eqByteDoubleQ(1.toByte(), undefined))
    assertTrue(eqByteQDouble(0.toByte(), 0.toDouble()))

Response:
assertFalse(eqByteQDouble(0.toByte(), 1.toDouble()))
    assertFalse(eqByteQDouble(1.toByte(), 0.toDouble()))
    assertTrue(eqByteQDouble(1.toByte(), 1.toDouble()))
    assertFalse(eqByteQDouble(null, 0.toDouble()))
    assertFalse(eqByteQDouble(null, 1.toDouble()))<|endoftext|>


Prompt:
val DOCUMENT_POSITION_CONTAINED_BY: Short
        val DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: Short
    }
}

/**
 * Exposes the JavaScript [SVGCursorElement](https://developer.mozilla.org/en/docs/Web/API/SVGCursorElement) to Kotlin
 */

Response:
public external abstract class SVGCursorElement : SVGElement, SVGURIReference, JsAny {
    open val x: SVGAnimatedLength
    open val y: SVGAnimatedLength

    companion object {
        val ELEMENT_NODE: Short
        val ATTRIBUTE_NODE: Short
        val TEXT_NODE: Short
        val CDATA_SECTION_NODE: Short<|endoftext|>


Prompt:
fun test_ok_1(base: Base) {
    val x = when (base) {
        is A -> 1
        is B -> 2
        is E -> 3
    }
}

fun test_ok_2(base: Base) {
    val x = when (base) {
        is A -> 1
        is B.C -> 2
        is B.D -> 3
        E.First -> 4

Response:
E.Second -> 5
    }
}

fun test_ok_3(sameFile: SameFile) {
    val x = when (sameFile) {
        is SameFile.A -> 1
        is SameFile.B -> 2
    }
}

fun test_error_1(base: Base) {<|endoftext|>


Prompt:
val answers = arrayOf(
            0x7ff8000000000000UL,     0x7ff8000000000000UL,     0x3ff0000000000000UL,     0xbfefffe62ecfab75UL,
            0x7ff8000000000000UL,     0x3fd745ba83a7adcaUL,     0x3ff0000000000000UL,     0x3ff0000000000000UL,

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


Prompt:
override fun getDeclaredClass(symbol: IrClassSymbol) = symbol

    override fun getDeclaredScript(symbol: IrScriptSymbol) = symbol

    override fun getDeclaredFunction(symbol: IrSimpleFunctionSymbol) = symbol

    override fun getDeclaredProperty(symbol: IrPropertySymbol) = symbol

Response:
override fun getDeclaredField(symbol: IrFieldSymbol) = symbol

    override fun getDeclaredFile(symbol: IrFileSymbol) = symbol

    override fun getDeclaredConstructor(symbol: IrConstructorSymbol) = symbol

    override fun getDeclaredEnumEntry(symbol: IrEnumEntrySymbol) = symbol<|endoftext|>


Prompt:
override val diagnosticClass get() = OverrideCannotBeStatic::class
    }

    interface JvmStaticNotInObjectOrClassCompanion : KtFirDiagnostic<PsiElement> {
        override val diagnosticClass get() = JvmStaticNotInObjectOrClassCompanion::class
    }

Response:
interface JvmStaticNotInObjectOrCompanion : KtFirDiagnostic<PsiElement> {
        override val diagnosticClass get() = JvmStaticNotInObjectOrCompanion::class
    }

    interface JvmStaticOnNonPublicMember : KtFirDiagnostic<PsiElement> {
        override val diagnosticClass get() = JvmStaticOnNonPublicMember::class
    }<|endoftext|>


Prompt:
override fun conflictinglyAnnotatedProduce(): <!RETURN_TYPE_MISMATCH_ON_OVERRIDE!>String?<!>
}

fun test(
    a: conflictinglyannotatedpackage.UnannotatedType,
    b: unannotatedpackage.ConflictinglyAnnotatedType,
    c: unannotatedpackage.UnannotatedType
) {

Response:
a.unannotatedConsume(<!NULL_FOR_NONNULL_TYPE!>null<!>)
    b.unannotatedConsume(<!NULL_FOR_NONNULL_TYPE!>null<!>)
    c.conflictinglyAnnotatedConsume(<!NULL_FOR_NONNULL_TYPE!>null<!>)<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J?")!>a<!>.propNullableAny
        <!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J?")!>a<!>.funT()

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J?")!>a<!><!UNSAFE_CALL!>.<!>funAny()
        <!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J?")!>a<!>.funNullableT()<|endoftext|>


Prompt:
public fun maxOf(a: kotlin.ULong, vararg other: kotlin.ULong): kotlin.ULong

@kotlin.SinceKotlin(version = "1.5")
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalUnsignedTypes::class})

Response:
public fun maxOf(a: kotlin.UShort, b: kotlin.UShort): kotlin.UShort

@kotlin.SinceKotlin(version = "1.5")
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalUnsignedTypes::class})
@kotlin.internal.InlineOnly<|endoftext|>


Prompt:
":allTests",
                )
                assertNoTestsStateFileException()
            }

            build(":allTests") {
                assertTasksUpToDate(
                    ":jsNodeTest",
                    ":jsTest",
                    ":jvmWithoutJavaTest",
                    ":${nativeTarget}Test",
                    ":allTests",
                )
                assertNoTestsStateFileException()
            }

Response:
build(":jvmWithoutJavaTest") {
                assertTasksUpToDate(
                    ":jvmWithoutJavaTest",
                )
                assertNoTestsStateFileException()
            }

            build(":jsTest") {
                assertTasksUpToDate(
                    ":jsNodeTest",
                )
                assertNoTestsStateFileException()
            }<|endoftext|>


Prompt:
(irConstructor.body as IrBlockBody).statements.forEach { statement ->
                statement.setDeclarationsParent(result)
                +statement.transformStatement(object : IrElementTransformerVoid() {
                    override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall): IrExpression {
                        expression.transformChildrenVoid()

                        return irBlock(expression) {

Response:
thisVar = if (irConstructor.isPrimary) {
                                // Note: block is empty in this case.
                                result.valueParameters.single()
                            } else {
                                val value = lowerConstructorCallToValue(expression, expression.symbol.owner)
                                irTemporary(value)
                            }
                        }
                    }

                    override fun visitGetValue(expression: IrGetValue): IrExpression {<|endoftext|>


Prompt:
if (a.b !== null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float & kotlin.Float?")!>a.b<!>.funNullableAny()
    if (a.b !== null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float & kotlin.Float?")!>a.b<!>

Response:
if (a.e !== null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char"), DEBUG_INFO_SMARTCAST!>a.e<!>.equals(null)
    if (a.e !== null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char"), DEBUG_INFO_SMARTCAST!>a.e<!>.propT<|endoftext|>


Prompt:
classpath = getMainKtsClassPath()
        )
    }

    @Test
    fun testStandardScriptWithDepsViaKotlinc() {
        runWithKotlinc(
            "$TEST_DATA_DIR/integration/withDependencyOnCompileClassPath.kts", listOf("Hello from standard kts!"),
            classpath = getMainKtsClassPath()
        )

Response:
}

    @Test
    fun testExpression() {
        runWithK2JVMCompiler(
            arrayOf(
                "-expression",
                "val x = 7; println(x * 6); for (arg in args) println(arg)",
                "--",
                "hi",
                "there"
            ),
            listOf("42", "hi", "there")
        )
    }<|endoftext|>


Prompt: <!DEBUG_INFO_EXPRESSION_TYPE("ClassWithThreeTypeParameters<out kotlin.Int?, out kotlin.Short?, ClassWithThreeTypeParameters<out kotlin.Int?, out kotlin.Short?, out kotlin.String?>?> & ClassWithThreeTypeParameters<out kotlin.Int?, out kotlin.Short?, ClassWithThreeTypeParameters<out

Response: kotlin.Int?, out kotlin.Short?, out kotlin.String?>?>?")!>x<!>.propT<|endoftext|>


Prompt:
if (3u in 1u..3u != range0.contains(3u)) throw AssertionError()
    if (3u !in 1u..3u != !range0.contains(3u)) throw AssertionError()
    if (!(3u in 1u..3u) != !range0.contains(3u)) throw AssertionError()

Response:
if (!(3u !in 1u..3u) != range0.contains(3u)) throw AssertionError()
    // no local optimizations
    if (element3 in 1u..3u != range0.contains(element3)) throw AssertionError()
    if (element3 !in 1u..3u != !range0.contains(element3)) throw AssertionError()<|endoftext|>


Prompt:
+"       CG NODE #${constraintNode.id}: ${constraintNode.toString(allTypes)}"
                        }
                        +"Returns: #${ids[function.body.returns]}"
                        +""
                    }
                }

                suitableTypes.forEach {
                    it?.and(instantiatingClasses)
                    it?.set(VIRTUAL_TYPE_ID)

Response:
}
            }

            private fun createFunctionConstraintGraph(symbol: DataFlowIR.FunctionSymbol, isRoot: Boolean): Function? {
                if (symbol is DataFlowIR.FunctionSymbol.External) return null
                constraintGraph.functions[symbol]?.let { return it }<|endoftext|>


Prompt:
if (x != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char & kotlin.Char?")!>this.x<!>.funNullableT()
        if (x != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char & kotlin.Char?")!>this.x<!>.funNullableAny()

Response:
if (x != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char & kotlin.Char?")!>this.x<!>
        if (this.x != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char & kotlin.Char?"), DEBUG_INFO_SMARTCAST!>x<!>.equals(null)<|endoftext|>


Prompt:
if (log != expectedLog) throw AssertionError("$id expectedLog: $expectedLog, actual: $log")
}

object A {
    var x = 0
        get() = field.also { log += "get-A.x;" }
        set(value: Int) {
            log += "set-A.x;"
            field = value
        }

}

Response:
fun getA() = A.also { log += "getA();" }

object B {
    var x = 0

    operator fun get(i1: Int, i2: Int, i3: Int): Int = x.also { log += "get-B($i1, $i2, $i3);" }<|endoftext|>


Prompt:
// `LLFirSessionCache` is used as a disposable parent so that disposal is triggered after the Kotlin plugin is unloaded. We don't
        // register a module as a disposable parent, because (1) IJ `Module`s may persist beyond the plugin's lifetime, (2) not all
        // `KtModule`s have a corresponding `Module`, and (3) sessions are invalidated (and subsequently cleaned up) when their module is

Response:
// removed.
        Disposer.register(LLFirSessionCache.getInstance(project), disposable)

        disposable
    }

    /**
     * Returns an already registered [Disposable] which is alive until the session is invalidated. It can be used as a parent disposable for<|endoftext|>


Prompt:
import org.jetbrains.kotlin.utils.addToStdlib.runUnless
import org.jetbrains.org.objectweb.asm.Type

class FirJvmTypeMapper(val session: FirSession) : FirSessionComponent {
    companion object {
        val NON_EXISTENT_ID = ClassId.topLevel(StandardNames.NON_EXISTENT_CLASS)

Response:
private val typeForNonExistentClass = NON_EXISTENT_ID.toLookupTag().constructClassType(ConeTypeProjection.EMPTY_ARRAY, isNullable = false)
    }

    fun mapType(
        type: ConeKotlinType,
        mode: TypeMappingMode = TypeMappingMode.DEFAULT,
        sw: JvmSignatureWriter? = null,<|endoftext|>


Response:
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.isEqualTo
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.pointers.KtFe10NeverRestoringSymbolPointer<|endoftext|>


Prompt:
private val rendererForC: DiagnosticParameterRenderer<C>?,
    private val rendererForD: DiagnosticParameterRenderer<D>?,
) : AbstractDiagnosticWithParametersRenderer<DiagnosticWithParameters4<*, A, B, C, D>>(message) {

Response:
override fun renderParameters(diagnostic: DiagnosticWithParameters4<*, A, B, C, D>): Array<out Any?> {
        val context = RenderingContext.of(diagnostic.a, diagnostic.b, diagnostic.c, diagnostic.d)
        return arrayOf(
            renderParameter(diagnostic.a, rendererForA, context),<|endoftext|>


Prompt:
state: GenerationState
    ): Set<BridgeForBuiltinSpecial<Signature>> {

        val functionHandle = DescriptorBasedFunctionHandleForJvm(function, state)
        val fake = !functionHandle.isDeclaration
        val overriddenBuiltin = function.getOverriddenBuiltinReflectingJvmDescriptor()!!

        val reachableDeclarations = findAllReachableDeclarations(function, state)

Response:
// e.g. `getSize()I`
        val methodItself = signatureByDescriptor(function)
        // e.g. `size()I`
        val specialBridgeSignature = signatureByDescriptor(overriddenBuiltin)

        val specialBridgeExists = function.getSpecialBridgeSignatureIfExists(signatureByDescriptor) != null<|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\21:java.lang.Object[]=java.lang.Integer[], $i$f$map\21\450:int=0:int,

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


Prompt:
class UnsafeCall(val actualType: ConeKotlinType) : ResolutionDiagnostic(UNSAFE_CALL)

object LowerPriorityToPreserveCompatibilityDiagnostic : ResolutionDiagnostic(RESOLVED_NEED_PRESERVE_COMPATIBILITY)

object LowerPriorityForDynamic : ResolutionDiagnostic(RESOLVED_LOW_PRIORITY)

Response:
object CandidateChosenUsingOverloadResolutionByLambdaAnnotation : ResolutionDiagnostic(RESOLVED)

class UnstableSmartCast(val argument: FirSmartCastExpression, val targetType: ConeKotlinType, val isCastToNotNull: Boolean, val isImplicitInvokeReceiver: Boolean) :
    ResolutionDiagnostic(UNSTABLE_SMARTCAST)<|endoftext|>


Prompt:
override fun lower(irFile: IrFile) {
        irFile.transformChildrenVoid(object : IrElementTransformerVoid() {
            override fun visitClass(declaration: IrClass): IrStatement {
                declaration.transformChildrenVoid()
                if (declaration.kind == ClassKind.ENUM_CLASS)
                    EnumClassTransformer(declaration).run()
                return declaration
            }

Response:
})
    }

    private inner class EnumClassTransformer(val irClass: IrClass) {
        private val valuesField = context.irFactory.buildField {
            startOffset = irClass.startOffset
            endOffset = irClass.endOffset
            origin = DECLARATION_ORIGIN_ENUM
            name = "VALUES".synthesizedName<|endoftext|>


Prompt:
fun javaClassesDir(
        sourceSet: String = "main",
    ): Path = classesDir(sourceSet, language = "java")

    fun kotlinSourcesDir(
        sourceSet: String = "main",
    ): Path = projectPath.resolve("src/$sourceSet/kotlin")

    fun javaSourcesDir(
        sourceSet: String = "main",

Response:
): Path = projectPath.resolve("src/$sourceSet/java")

    fun relativeToProject(
        files: List<Path>,
    ): List<Path> = files.map { projectPath.relativize(it) }
}

/**
 * You need at least [TestVersions.Gradle.G_7_0] for supporting environment variables with gradle runner
 */
@JvmInline<|endoftext|>


Prompt:
val classDescriptor = (serializerDescriptor.containingDeclaration as? ClassDescriptor) ?: return null
    if (!classDescriptor.shouldHaveGeneratedSerializer) return null
    return classDescriptor
}

fun ClassDescriptor.checkSerializableClassPropertyResult(prop: PropertyDescriptor): Boolean =

Response:
prop.returnType!!.isSubtypeOf(getClassFromSerializationPackage(SerialEntityNames.SERIAL_DESCRIPTOR_CLASS).toSimpleType(false)) // todo: cache lookup

// todo: serialization: do an actual check better that just number of parameters
fun ClassDescriptor.checkSaveMethodParameters(parameters: List<ValueParameterDescriptor>): Boolean =
    parameters.size == 2<|endoftext|>


Prompt:
private fun CheckerContext.checkCustomSerializerIsNotLocal(
        source: KtSourceElement?,
        classSymbol: FirClassSymbol<*>,
        serializerType: ConeKotlinType,
        reporter: DiagnosticReporter
    ) {
        val serializerClassId = serializerType.classId ?: return
        if (serializerClassId.isLocal) {

Response:
reporter.reportOn(
                source ?: classSymbol.serializableOrMetaAnnotationSource(session),
                FirSerializationErrors.LOCAL_SERIALIZER_USAGE,
                serializerType,
                this
            )
        }
    }

    private fun CheckerContext.checkSerializerNullability(
        classType: ConeKotlinType,<|endoftext|>


Prompt:
* PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3
 * SECONDARY LINKS: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1
 * statements, assignments, operator-assignments -> paragraph 2 -> sentence 2

Response:
* statements, assignments, operator-assignments -> paragraph 2 -> sentence 3
 * NUMBER: 1
 * DESCRIPTION: nullable receiver
 */

fun box(): String {
    val a: A? = A(B())
    val c: C = C()

    a?.b += c
    if (f3 && !f1 && !f2 && !f4) {
        f3 = false<|endoftext|>


Prompt:
fun <T: SameUserInterface> testTypeParameterWithTypeAliasedUpperBoundsB(arg: T) {}

    fun <T: UserInterface> testTypeParameterWithTypeAliasedUpperBoundsBReverse(arg: T) {}

Response:
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T: SameUserInterface> testTypeParameterWithTypeAliasedUpperBoundsBReverse(arg: T) {}

    @Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T: UserInterface> testTypeParameterWithTypeAliasedUpperBoundsC(arg: Invariant<T>) {}<|endoftext|>


Prompt:
// FIR_IDENTICAL
// !LANGUAGE: +ForbidUsingExtensionPropertyTypeParameterInDelegate
// WITH_REFLECT

import kotlin.reflect.KProperty
import kotlin.properties.ReadOnlyProperty

fun <T, V> logged(getter: (T) -> V) =
    ReadOnlyProperty<T, V> { thisRef, property ->

Response:
println("Getter for $property is invoked")
        getter(thisRef)
    }

val <T> List<T>.second: T by logged { it[1] }

class Delegate<T>(private val fn: (List<T>) -> T) {
    private var cache: T? = null

    operator fun getValue(thisRef: List<T>, kProperty: KProperty<*>) =<|endoftext|>


Prompt:
import org.jetbrains.kotlin.resolve.CompileTimeConstantUtils
import org.jetbrains.kotlin.resolve.bindingContextUtil.getEnclosingFunctionDescriptor
import org.jetbrains.kotlin.resolve.bindingContextUtil.recordUsedAsExpression
import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall

Response:
import org.jetbrains.kotlin.resolve.calls.model.ArgumentMatch
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind<|endoftext|>


Prompt:
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.lowerIfFlexible
import org.jetbrains.org.objectweb.asm.Type

Response:
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter

class ResourcePropertyStackValue(
        val receiver: StackValue,
        private val typeMapper: KotlinTypeMapper,
        val resource: PropertyDescriptor,
        val container: ClassDescriptor,
        private val containerOptions: ContainerOptionsProxy,
        private val androidPackage: String,<|endoftext|>


Prompt:
) : KtCallCandidateInfo(candidate, isInBestCandidates)

/**
 * A candidate that is NOT applicable for a call. A candidate is inapplicable if a call argument is missing or is not assignable to the
 * candidate's parameters, OR a call type argument is missing or does not fit the constraints of the candidate's type parameters.
 */
public class KtInapplicableCallCandidateInfo(

Response:
candidate: KtCall,
    isInBestCandidates: Boolean,
    private val _diagnostic: KtDiagnostic,
) : KtCallCandidateInfo(candidate, isInBestCandidates) {
    /**
     * The reason the [candidate] was not applicable for the call (e.g., argument type mismatch, or no value for parameter).
     */<|endoftext|>


Prompt:
// test.kt:7 foo
// test.kt:11 foo
// test.kt:13 foo
// test.kt:5 foo
// test.kt:8 foo
// test.kt:11 foo
// test.kt:14 foo
// test.kt:11 foo
// test.kt:16 foo
// test.kt:13 foo
// test.kt:11 foo
// test.kt:16 foo

Response:
// test.kt:6 foo
// test.kt:11 foo
// test.kt:12 foo
// test.kt:5 foo
// test.kt:7 foo
// test.kt:5 foo
// test.kt:8 foo
// test.kt:11 foo
// test.kt:14 foo
// test.kt:11 foo
// test.kt:16 foo
// test.kt:7 foo<|endoftext|>


Prompt:
// JVM_ABI_K1_K2_DIFF: KT-63861

// FILE: 1.kt

package test

public inline fun doCall(block: ()-> Long, exception: (e: Exception)-> Unit, finallyBlock: ()-> Long, res: Long = -1111.toLong()) : Long {
    try {
        block()
    } catch (e: Exception) {

Response:
exception(e)
    } finally {
        finallyBlock()
    }
    return res
}

public inline fun <R> doCall2(block: ()-> R, exception: (e: Exception)-> Unit, finallyBlock: ()-> R, res: R) : R {
    try {
        return block()
    } catch (e: Exception) {
        exception(e)
    } finally {<|endoftext|>


Prompt:
require(copyCall is FirMultiDelegatedConstructorCall)
            require(targetCall.delegatedConstructorCalls.size == copyCall.delegatedConstructorCalls.size)

            val newCalls = targetCall.delegatedConstructorCalls.zip(copyCall.delegatedConstructorCalls)

Response:
.map { (target, copy) -> target.takeUnless { it is FirLazyDelegatedConstructorCall } ?: copy }

            targetCall.replaceDelegatedConstructorCalls(newCalls)
        }
    }
}

private fun replaceLazyInitializer(target: FirVariable, copy: FirVariable) {
    if (target.initializer is FirLazyExpression) {<|endoftext|>


Prompt:
private fun findInaccessibleJavaClasses(type: KotlinType, c: ResolutionContext<*>): Collection<ClassDescriptor> {
        val scopeOwner = c.scope.ownerDescriptor
        val inaccessibleJavaClasses = LinkedHashSet<ClassDescriptor>()
        findInaccessibleJavaClassesRec(type, scopeOwner, inaccessibleJavaClasses, c.languageVersionSettings)
        return inaccessibleJavaClasses

Response:
}

    private fun findInaccessibleJavaClassesRec(
            type: KotlinType,
            scopeOwner: DeclarationDescriptor,
            inaccessibleClasses: MutableCollection<ClassDescriptor>,
            languageVersionSettings: LanguageVersionSettings
    ) {
        val declarationDescriptor = type.constructor.declarationDescriptor

        if (declarationDescriptor is JavaClassDescriptor) {<|endoftext|>


Prompt:
}
}

fun ConeDefinitelyNotNullType.Companion.create(
    original: ConeKotlinType,
    typeContext: ConeTypeContext,
    // Sometimes, it might be called before type parameter bounds are initialized
    // or even before the symbols are bound to FIR
    // In such cases, we just assume it makes sense to create DNN there

Response:
// NB: `makesSenseToBeDefinitelyNotNull` is mostly an optimization, it should not affect semantics
    avoidComprehensiveCheck: Boolean = false,
): ConeDefinitelyNotNullType? {
    return when (original) {
        is ConeDefinitelyNotNullType -> original
        is ConeFlexibleType -> create(original.lowerBound, typeContext, avoidComprehensiveCheck)<|endoftext|>


Prompt: 0x3d6bffb390866e47UL,     0x400921fb54441119UL,     0x400921fb54441119UL,     0x400921fb54441119UL,

Response:
0x400921fb5443f519UL,     0x400921fb54441f18UL,     0x400921fb5443bd19UL,     0x400921fb54442618UL,
            0xc00921fb54442d18UL,     0x8000000000000000UL,     0xbff921fb54442d18UL,     0x8000000000002bfbUL,<|endoftext|>


Prompt:
open fun b74(): Int = 74
        open fun b75(): Int = 75
        open fun b76(): Int = 76
        open fun b77(): Int = 77
        open fun b78(): Int = 78
        open fun b79(): Int = 79
        open fun b80(): Int = 80
        open fun b81(): Int = 81
        open fun b82(): Int = 82
        open fun b83(): Int = 83

Response:
open fun b84(): Int = 84
        open fun b85(): Int = 85
        open fun b86(): Int = 86
        open fun b87(): Int = 87
        open fun b88(): Int = 88
        open fun b89(): Int = 89
        open fun b90(): Int = 90
        open fun b91(): Int = 91
        open fun b92(): Int = 92
        open fun b93(): Int = 93<|endoftext|>


Prompt:
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses

OPTIONAL_JVM_INLINE_ANNOTATION
value class IC1(val value: Int)

OPTIONAL_JVM_INLINE_ANNOTATION
value class IC2(val value: Int)

Response:
fun foo(x: IC1, y: IC2) = (x as Any) == y

fun box(): String {
    if ((IC1(1) as Any) == IC2(1)) return "Fail 1"
    if (foo(IC1(1), IC2(1))) return "Fail 2"
    return "OK"
}<|endoftext|>


Prompt:
trace.reportDiagnosticOnce(Errors.REPEATED_ANNOTATION.on(entry))
                } else {
                    trace.report(Errors.REPEATED_ANNOTATION_WARNING.on(entry))
                }
            }
        }
    }

    private fun checkSuperTypeAnnotations(annotated: KtClassOrObject, trace: BindingTrace) {

Response:
for (superType in annotated.superTypeListEntries.mapNotNull { it.typeReference }) {
            checkTypeReference(superType, trace, isSuperType = true)
        }
    }

    private fun checkTypeReference(
        reference: KtTypeReference,
        trace: BindingTrace,
        isSuperType: Boolean = false,
        shouldCheckReferenceItself: Boolean = false,<|endoftext|>


Prompt:
* Provides sequential consistent ordering guarantees.
     *
     * @throws [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
     */
    public fun getAndAdd(index: Int, delta: Long): Long {
        checkBounds(index)
        return array.getAndAdd(index, delta)
    }

    /**

Response:
* Atomically adds the given [delta] to the element at the given [index] and returns the new value of the element.
     *
     * Provides sequential consistent ordering guarantees.
     *
     * @throws [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
     */
    public fun addAndGet(index: Int, delta: Long): Long {<|endoftext|>


Prompt:
setterDeprecated.<!DEPRECATION!>p<!> = 1

    hiddenDeprecated.<!UNRESOLVED_REFERENCE!>p<!>
    hiddenDeprecated.<!UNRESOLVED_REFERENCE!>p<!> = 1

    wd.p
    wd.p = 1

    ed.p
    ed.p = 1

    gd.p

Response:
gd.p = 1

    sd.p
    sd.p = 1

    sdh.p
    sdh.p = 1

    edh.p
    edh.p = 1

    ned.p
    ned.p = 1

    diff.<!DEPRECATION_ERROR!>p<!><|endoftext|>


Prompt:
tailrec fun foo5(x: String = withEffects(), y: String = withEffects(), z: String = withEffects()) {
    foo5(x, y, z)
}

tailrec fun foo6(x: String = withEffects(), y: EnumA = EnumA.A) {
    foo6(x, y)
}

Response:
tailrec fun foo7(x: String = withEffects(), y: KClass<out EnumA> = EnumA.A::class) {
    foo7(x, y)
}<|endoftext|>


Prompt:
override val icLogLines: List<String>,
    val kotlinLanguageVersion: KotlinVersion?,
    val changedFiles: SourcesChanges? = null,
    val compilerArguments: Array<String> = emptyArray(),
    val statTags: Set<StatTag> = emptySet(),
) : BuildOperationRecord {

Response:
override val isFromKotlinPlugin: Boolean = classFqName.startsWith("org.jetbrains.kotlin")
}

private class TransformRecord(
    override val path: String,
    override val classFqName: String,
    override val isFromKotlinPlugin: Boolean,
    override val startTimeMs: Long,
    override val totalTimeMs: Long,<|endoftext|>


Prompt:
fun throwExceptionB(b: Boolean) = run { if (b) throw ExcB() }

class ExcA() : Exception()
class ExcB() : Exception()

fun box(): String {

    var flag = false
    try {
        throwExceptionB(true)
        flag = true
    } catch (e: ExcA) {
        return "NOK"
    } catch (e: Exception) {

Response:
return if (flag)
            "NOK"
        else "OK"
    }catch (e : ExcB){
        return "NOK"
    }
    return "NOK"
}<|endoftext|>