Prompt:
firDiagnostic: KtPsiDiagnostic,
    token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtBinaryExpression>(firDiagnostic, token), KtFirDiagnostic.EqualityNotApplicableWarning

internal class IncompatibleEnumComparisonErrorImpl(
    override val leftType: KtType,

Response:
override val rightType: KtType,
    firDiagnostic: KtPsiDiagnostic,
    token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.IncompatibleEnumComparisonError

internal class IncompatibleEnumComparisonImpl(<|endoftext|>


Prompt:
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinSourceCoordinates
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinSourceDependency
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet

Response:
import org.jetbrains.kotlin.gradle.plugin.ide.IdeDependencyResolver
import org.jetbrains.kotlin.gradle.plugin.ide.IdeaKotlinProjectCoordinates
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution<|endoftext|>


Prompt:
type.isUShort -> KtConstantValue.KtUnsignedShortConstantValue((value as Number).toShort().toUShort(), expression)
            type.isInt -> KtConstantValue.KtIntConstantValue((value as Number).toInt(), expression)

Response:
type.isUInt -> KtConstantValue.KtUnsignedIntConstantValue((value as Number).toInt().toUInt(), expression)
            type.isLong -> KtConstantValue.KtLongConstantValue((value as Number).toLong(), expression)<|endoftext|>


Prompt:
assertFalse(eqIntChar(1.toInt(), 1.toChar()))
    assertFalse(eqIntCharQ(0.toInt(), 0.toChar()))
    assertFalse(eqIntCharQ(0.toInt(), 1.toChar()))
    assertFalse(eqIntCharQ(0.toInt(), null))
    assertFalse(eqIntCharQ(0.toInt(), undefined))

Response:
assertFalse(eqIntCharQ(1.toInt(), 0.toChar()))
    assertFalse(eqIntCharQ(1.toInt(), 1.toChar()))
    assertFalse(eqIntCharQ(1.toInt(), null))
    assertFalse(eqIntCharQ(1.toInt(), undefined))
    assertFalse(eqIntQChar(0.toInt(), 0.toChar()))<|endoftext|>


Prompt:
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.parsing.KotlinParserDefinition
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.scripting.resolve.KtFileScriptSource

Response:
import org.jetbrains.kotlin.scripting.resolve.VirtualFileScriptSource
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract
import kotlin.script.experimental.api.SourceCode

inline fun <T> runReadAction(crossinline runnable: () -> T): T {<|endoftext|>


Prompt:
is IrConstructorSymbol -> getReferencedConstructor(symbol)
                    else -> error("Unexpected symbol $symbol ${symbol.descriptor}")
                }

            override fun getReferencedSimpleFunction(symbol: IrSimpleFunctionSymbol) = when {
                symbol.descriptor.isExpect -> symbol.owner.findActualForExpected().symbol

Response:
symbol.descriptor.propertyIfAccessor.isExpect -> {
                    val property = symbol.owner.correspondingPropertySymbol!!.owner
                    val actualPropertyDescriptor = property.descriptor.findActualForExpect()
                    val accessorDescriptor = when (symbol.owner) {
                        property.getter -> actualPropertyDescriptor.getter!!<|endoftext|>


Prompt:
package foo

import org.jetbrains.kotlin.fir.plugin.MyInterfaceSupertype

interface MyInterface {
    fun foo()
}

@MyInterfaceSupertype
abstract class AbstractClass

@MyInterfaceSupertype
class FinalClassWithOverride {
    override fun foo() {}
}

@MyInterfaceSupertype

Response:
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class FinalClassWithoutOverride<!> {
    // should be error
}

class NotAnnotatedWithOverride {
    // should be error
    <!NOTHING_TO_OVERRIDE!>override<!> fun foo() {}
}

@MyInterfaceSupertype
class AnnotatedClassWithExplicitInheritance : MyInterface {<|endoftext|>


Prompt:
val atomicProperty = getPropertyReceiver.getCorrespondingProperty()
                    val volatileProperty = atomicfuPropertyToVolatile[atomicProperty]
                        ?: error("No volatile property was generated for the atomic property ${atomicProperty.render()}")
                    val valueType = volatileProperty.backingField!!.type
                    return IrFunctionExpressionImpl(
                        UNDEFINED_OFFSET, UNDEFINED_OFFSET,

Response:
type = atomicSymbols.kMutableProperty0GetterType(valueType),
                        function = irBuiltIns.irFactory.buildFun {
                            name = Name.identifier("<${volatileProperty.name.asString()}-getter-${refGetterCounter++}>")
                            origin = AbstractAtomicSymbols.ATOMICFU_GENERATED_FUNCTION<|endoftext|>


Prompt:
* The class representing the failure result
     * @param reports diagnostics associated with the failure
     */
    data class Failure(
        override val reports: List<ScriptDiagnostic>
    ) : ResultWithDiagnostics<Nothing>() {
        constructor(vararg reports: ScriptDiagnostic) : this(reports.asList())
    }
}

/**
 * Chains actions on successful result:

Response:
* If receiver is success - executes [body] and merge diagnostic reports
 * otherwise returns the failure as is
 */
inline fun <R1, R2> ResultWithDiagnostics<R1>.onSuccess(body: (R1) -> ResultWithDiagnostics<R2>): ResultWithDiagnostics<R2> =
    when (this) {<|endoftext|>


Prompt:
for (i in 1..benchmarkSize) {
            val element = alloc<ElementS>()
            element.floatValue = i + sqrt(i.toDouble()).toFloat()
            element.integer = i.toLong()
            sprintf(element.string, "%d", i)
            element.contains = containsFunction

            elementsList.add(element)
        }

Response:
val summary = elementsList.map { multiplyElementS(it.readValue(), (0..10).random()) }
                .reduce { acc, it -> sumElementSPtr(acc.ptr, it.ptr)!!.pointed.readValue() }
        val intValue = summary.useContents { integer }
        elementsList.last().contains!!(elementsList.last().ptr, elementsList.first().ptr)<|endoftext|>


Prompt:
package org.jetbrains.kotlin.gradle.testbase

import java.nio.file.Path

fun Path.applyKotlinCompilerArgsPlugin() {
    applyPlugin(
        "org.jetbrains.kotlin.test.kotlin-compiler-args-properties",
        "org.jetbrains.kotlin:kotlin-compiler-args-properties",

Response:
"test_fixes_version"
    )
}<|endoftext|>


Prompt:
val libraryName = binaryLibrary.libraryFile.nameWithoutExtension.substringAfter("lib")
        val clangResult = compileWithClang(
            clangDistribution = ClangDistribution.Llvm,
            clangMode = clangMode,
            sourceFiles = cSources,
            includeDirectories = includeDirectories,
            outputFile = executableFile,

Response:
libraryDirectories = listOf(binaryLibrary.libraryFile.parentFile),
            libraries = listOf(libraryName),
            additionalClangFlags = getKindSpecificClangFlags(binaryLibrary) + listOf("-Wall", "-Werror"),
        ).assertSuccess()

        val testExecutable = TestExecutable(
            clangResult.resultingArtifact,<|endoftext|>


Prompt:
KotlinTypes.any.makeNullable().toStubIrType(),
                isVararg = true,
                annotations = emptyList()
        )
    }
    return result
}

private class ObjCMethodStubBuilder(
        private val method: ObjCMethod,
        private val container: ObjCContainer,
        private val isDesignatedInitializer: Boolean,

Response:
override val context: StubsBuildingContext,
) : StubElementBuilder {
    private val isStret: Boolean
    private val stubReturnType: StubType
    val annotations = mutableListOf<AnnotationStub>()
    private val kotlinMethodParameters: List<FunctionParameterStub>
    private val external: Boolean
    private val receiver: ReceiverParameterStub?<|endoftext|>


Prompt:
public static Sub sub;

    public static Collection<Sub> subs;
    public static Collection<Super> supers;
}

// FILE: k.kt

import p.*

fun test() {
    val col = if (1 < 2) Other.subs else Other.supers
    col.foo()
}

fun <T: Super> Collection<T>.foo(): T = null!!

Response: fun <T> listOf(t: T): List<T> = null!!<|endoftext|>


Prompt:
get() = classId ?: ClassId(containingPackage() ?: FqName.ROOT, FqName.topLevel(this.name), isLocal = true)

internal fun ClassDescriptor.getSupertypesWithAny(): Collection<KotlinType> {
    val supertypes = typeConstructor.supertypes
    if (isInterfaceLike) {
        return supertypes
    }

Response:
val hasClassSupertype = supertypes.any { (it.constructor.declarationDescriptor as? ClassDescriptor)?.kind == ClassKind.CLASS }
    return if (hasClassSupertype) supertypes else listOf(builtIns.anyType) + supertypes
}

internal fun CallableMemberDescriptor.getSymbolPointerSignature(): String {<|endoftext|>


Prompt:
secondModifierToken,
                firstModifierToken,
                context
            )
        }
        Compatibility.REVERSE_REDUNDANT -> {
            reporter.reportOn(
                firstModifier.source,
                FirErrors.REDUNDANT_MODIFIER,
                firstModifierToken,
                secondModifierToken,
                context
            )
        }

Response:
Compatibility.DEPRECATED -> {
            reporter.reportOn(
                firstModifier.source,
                FirErrors.DEPRECATED_MODIFIER_PAIR,
                firstModifierToken,
                secondModifierToken,
                context
            )
            reporter.reportOn(
                secondModifier.source,
                FirErrors.DEPRECATED_MODIFIER_PAIR,<|endoftext|>


Prompt:
val ref = E::<!DEPRECATED_ACCESS_TO_ENUM_ENTRY_PROPERTY_AS_REFERENCE!>entries<!>
    val refType: (E) -> Int = E::entries

Response:
val refTypeWithAnyExpectedType: Any = E::<!DEPRECATED_ACCESS_TO_ENUM_ENTRY_PROPERTY_AS_REFERENCE!>entries<!>
}<|endoftext|>


Prompt:
if (oldProperty.parentAsClass.visibility == DescriptorVisibilities.PRIVATE) {
                context.createJvmIrBuilder(this.symbol).run {
                    annotations = filterOutAnnotations(DeprecationResolver.JAVA_DEPRECATED, annotations) +
                            irCall(irSymbols.javaLangDeprecatedConstructorWithDeprecatedFlag)
                }
            }
        }

Response:
}
}

@PhaseDescription(
    name = "RemapObjectFieldAccesses",
    description = "Make IrGetField/IrSetField to objects' fields point to the static versions",
    prerequisite = [JvmPropertiesLowering::class],
)
internal class RemapObjectFieldAccesses(val context: JvmBackendContext) : FileLoweringPass, IrElementTransformerVoid() {<|endoftext|>


Response: }<|endoftext|>


Prompt:
*  insn.next.next.next: INVOKESTATIC voidMagicApiCall
     */
    private fun isPluginNext(insn: AbstractInsnNode): Boolean {
        val magicInsn = insn.next?.next?.next ?: return false
        return magicInsn is MethodInsnNode && magicInsn.opcode == Opcodes.INVOKESTATIC

Response:
&& magicInsn.owner == pluginIntrinsicsMarkerOwner
                && magicInsn.name == pluginIntrinsicsMarkerMethod
                && magicInsn.desc == pluginIntrinsicsMarkerSignature
                && magicInsn.previous is LdcInsnNode
    }

    private inline fun rewriteNextTypeInsn(
        marker: MethodInsnNode,<|endoftext|>


Prompt:
"       private val _a = atomic<T>(initial) \n" +
                    "       public var a: T by _a \n" +
                    "       ```\n" +
                    "   * Directly invoke operations on atomic properties, like this:\n" +
                    "       ```\n" +
                    "       val top = atomic<Node?>(null)\n" +

Response:
"       top.compareAndSet(null, Node(1)) // OK\n" +
                    "       ```\n" +
                    "   * Refrain from invoking atomic operations on local variables:\n" +
                    "       ```\n" +
                    "       val top = atomic<Node?>(null)\n" +
                    "       val tmp = top\n" +<|endoftext|>


Prompt:
) = "$testTarget${if (debuggable) "-g" else ""}$cacheKind"
    }
}

enum class PipelineType(val mutedOption: MutedOption, val compilerFlags: List<String>) {
    DEFAULT(
        MutedOption.DEFAULT,
        emptyList()
    ),
    K1(
        MutedOption.K1,

Response:
listOf("-language-version", "1.9")
    ),
    K2(
        MutedOption.K2,
        listOf("-language-version", if (LanguageVersion.LATEST_STABLE.major < 2) "2.0" else LanguageVersion.LATEST_STABLE.toString())
    );<|endoftext|>


Prompt:
val x = foo(arr = intArrayOf(1, 2, 3))
    val y = bar(arr = uintArrayOf(1u, 2u, 3u))
    val z = baz(arr = ulongArrayOf(1uL, 2uL, 3uL))
    val q = quas(arr = ushortArrayOf(1u, 2u, 3u))

Response:
val w = wex(arr = ubyteArrayOf(1u, 2u, 3u))
    if (x + y.toInt() + z.toInt() + q.toInt() + w.toInt() == 30) {
        return "OK"
    }
    return "Fail"
}<|endoftext|>


Prompt:
package org.jetbrains.kotlin.extensions

import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.types.DefaultTypeAttributeTranslator
import org.jetbrains.kotlin.types.TypeAttributeTranslator
import org.jetbrains.kotlin.types.extensions.TypeAttributeTranslators

Response:
interface TypeAttributeTranslatorExtension : TypeAttributeTranslator {
    companion object : ProjectExtensionDescriptor<TypeAttributeTranslatorExtension>(
        "org.jetbrains.kotlin.extensions.typeAttributeTranslatorExtension",
        TypeAttributeTranslatorExtension::class.java
    ) {
        val Default = TypeAttributeTranslators(listOf(DefaultTypeAttributeTranslator))<|endoftext|>


Prompt:
val invocationKind = if (proto.hasKind())
                        proto.kind.toDescriptorInvocationKind() ?: return null
                    else
                        EventOccurrencesRange.UNKNOWN
                    CallsEffectDeclaration(callable, invocationKind)
                }
            }
        }

        private fun deserializeExpression(proto: ProtoBuf.Expression): BooleanExpression? {

Response:
val primitiveType = getPrimitiveType(proto)
            val primitiveExpression = extractPrimitiveExpression(proto, primitiveType)

            val complexType = getComplexType(proto)
            val childs: MutableList<BooleanExpression> = mutableListOf()
            childs.addIfNotNull(primitiveExpression)

            return when (complexType) {<|endoftext|>


Prompt:
kotlin.androidTarget()

        val commonMain = kotlin.sourceSets.getByName("commonMain")
        val commonTest = kotlin.sourceSets.getByName("commonTest")
        val jvmMain = kotlin.sourceSets.getByName("jvmMain")
        val jvmTest = kotlin.sourceSets.getByName("jvmTest")

Response:
val androidMain = kotlin.sourceSets.getByName("androidMain")
        val androidUnitTest = kotlin.sourceSets.getByName("androidUnitTest")
        val androidInstrumentedTest = kotlin.sourceSets.getByName("androidInstrumentedTest")

        project.evaluate()

        for (commonSourceSet in listOf(commonMain, commonTest)) {<|endoftext|>


Prompt:
for (i in 1 until (n + 1)) {
            val pName = Name.identifier("P$i")

            val pSymbol = descriptorFactory.typeParameterDescriptor(index) {
                irFactory.createTypeParameter(
                    startOffset = offset,
                    endOffset = offset,
                    origin = classOrigin,
                    name = pName,
                    symbol = it,

Response:
variance = Variance.IN_VARIANCE,
                    index = index++,
                    isReified = false
                )
            }
            val pDeclaration = pSymbol.owner

            pDeclaration.superTypes += irBuiltIns.anyNType
            pDeclaration.parent = this
            typeParametersArray.add(pDeclaration)
        }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.visitors.FirVisitor
import org.jetbrains.kotlin.fir.visitors.transformInplace
import org.jetbrains.kotlin.fir.visitors.transformSingle
import org.jetbrains.kotlin.name.Name

Response:
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
import kotlin.properties.Delegates

class FirJavaMethod @FirImplementationDetail constructor(
    override val source: KtSourceElement?,<|endoftext|>


Prompt:
type = WasmRefNullType(WasmHeapType.Type(context.referenceFunctionType(it.function.symbol))),
                isMutable = false
            )
        }

        return WasmStructDeclaration(
            name = name,
            fields = tableFields,
            superType = superType,
            isFinal = isFinal
        )
    }

Response:
private fun createVTable(metadata: ClassMetadata) {
        val klass = metadata.klass
        val symbol = klass.symbol
        val vtableName = "${klass.fqNameWhenAvailable}.vtable"
        val vtableStruct = createVirtualTableStruct(
            metadata.virtualMethods,
            vtableName,<|endoftext|>


Prompt:
DescriptorRenderer.withOptions { defaultDecompilerRendererOptions() }
    }

    override val metadataStubBuilder: KlibMetadataStubBuilder by lazy {
        Fe10KlibMetadataStubBuilder(stubVersion, fileType, serializerProtocol, ::readFileSafely)
    }

    override fun getDecompiledText(

Response:
file: FileWithMetadata.Compatible,
        serializerProtocol: SerializerExtensionProtocol,
        flexibleTypeDeserializer: FlexibleTypeDeserializer
    ): DecompiledText {
        return decompiledText(file, serializerProtocol, flexibleTypeDeserializer, renderer)
    }
}

/**<|endoftext|>


Prompt:
*
 * Rotating by a multiple of [Long.SIZE_BITS] (64) returns the same number, or more generally
 * `number.rotateRight(n) == number.rotateRight(n % 64)`
 */
@SinceKotlin("1.6")
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly

Response: public actual inline fun Long.rotateRight(bitCount: Int): Long = java.lang.Long.rotateRight(this, bitCount)<|endoftext|>


Prompt:
// TARGET_BACKEND: WASM

// RUN_THIRD_PARTY_OPTIMIZER
// WASM_DCE_EXPECTED_OUTPUT_SIZE: wasm  14_030
// WASM_DCE_EXPECTED_OUTPUT_SIZE: mjs    5_304
// WASM_OPT_EXPECTED_OUTPUT_SIZE:        2_936

Response:
// FILE: test.kt

@JsExport
fun add(a: Int, b: Int) = a + b

// FILE: entry.mjs
import { add } from "./index.mjs"

const r = add(2, 3);
if (r != 5) throw Error("Wrong result: " + r);<|endoftext|>


Prompt:
dirtySources.addAll(complementaryFiles)
            caches.platformCache.markDirty(dirtySources)
            caches.inputsCache.removeOutputForSourceFiles(dirtySources)

            val lookupTracker = LookupTrackerImpl(getLookupTrackerDelegate())
            val expectActualTracker = ExpectActualTrackerImpl()

Response:
val (sourcesToCompile, removedKotlinSources) = dirtySources.partition { it.exists() && allKotlinSources.contains(it) }

            icContext.fragmentContext?.let {
                if (it.dirtySetTouchesNonLeafFragments(sourcesToCompile)) {
                    throw RequireRebuildForCorrectnessInKMPException()
                }
            }<|endoftext|>


Prompt:
declareByDeclaration: SymbolTableSlice<D, SymbolOwner, Symbol>.(D, () -> Symbol, OwnerFactory<Symbol, SymbolOwner>) -> SymbolOwner,
        crossinline symbolFactory: (IdSignature?) -> Symbol,
        noinline ownerFactory: OwnerFactory<Symbol, SymbolOwner>,
        specificCalculateSignature: (D) -> IdSignature?
    ): SymbolOwner {

Response:
return when (val signature = specificCalculateSignature(declaration)) {
            null -> slice.declareByDeclaration(declaration, { symbolFactory(signature) }, ownerFactory)
            else -> table.declareBySignature(signature, { symbolFactory(signature) }, ownerFactory)
        }
    }<|endoftext|>


Prompt:
var isReceiver = true
        var hasQuestionMarkAtLHS = false
        var firReceiverExpression: FirExpression? = null
        lateinit var namedReference: FirNamedReference
        callableReferenceExpression.forEachChildren {
            when (it.tokenType) {
                COLONCOLON -> isReceiver = false
                QUEST -> hasQuestionMarkAtLHS = true

Response:
else -> if (it.isExpression()) {
                    if (isReceiver) {
                        firReceiverExpression = getAsFirExpression(it, "Incorrect receiver expression")
                    } else {
                        namedReference = createSimpleNamedReference(it.toFirSourceElement(), it)
                    }
                }
            }
        }

        return buildCallableReferenceAccess {<|endoftext|>


Prompt:
val declaration = declarationDescriptor
        if (declaration == null) {
            val errorArguments = arguments.map { TypeProjectionImpl(it as KotlinType) }
            return ErrorUtils.createErrorTypeWithArguments(ErrorTypeKind.UNRESOLVED_TYPE, errorArguments, this.toString())
        }

Response:
val substitutions = LinkedHashMap<TypeConstructor, TypeProjection>(parameters.size)
        for (index in parameters.indices) {
            val parameterTypeConstructor = parameters[index].typeConstructor
            substitutions[parameterTypeConstructor] = TypeProjectionImpl(arguments[index] as KotlinType)
        }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.analysis.api.symbols.psiSafe
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.sir.SirCallableKind

internal val KtCallableSymbol.sirCallableKind: SirCallableKind
    get() = when (symbolKind) {

Response:
KtSymbolKind.TOP_LEVEL -> {
            val isRootPackage = callableIdIfNonLocal?.packageName?.isRoot
            if (isRootPackage == true) {
                SirCallableKind.FUNCTION
            } else {
                SirCallableKind.STATIC_METHOD
            }
        }<|endoftext|>


Prompt:
constructor.signature?.let {
            appendCommentedLine("signature: ", it)
        }
    }

    override fun Printer.appendSignatures(function: KmFunction) {
        function.signature?.let {
            appendCommentedLine("signature: ", it)
        }
    }

    override fun Printer.appendSignatures(property: KmProperty) {

Response:
property.fieldSignature?.let {
            appendCommentedLine("field: ", it)
        }
        property.getterSignature?.let {
            appendCommentedLine("getter: ", it)
        }
        property.setterSignature?.let {
            appendCommentedLine("setter: ", it)
        }
    }<|endoftext|>


Prompt:
}

    @Test
    fun flatten() {
        assertEquals(listOf(0, 1, 2, 3, 0, 1, 2, 3), data.map { 0..it.length }.flatten())
    }

    @Test
    fun mapIndexed() {
        val shortened = data.mapIndexed { index, value -> value.substring(0..index) }

Response:
assertEquals(2, shortened.size)
        assertEquals(listOf("f", "ba"), shortened)
    }

    @Test
    fun withIndex() {
        val indexed = data.withIndex().map { it.value.substring(0..it.index) }
        assertEquals(2, indexed.size)
        assertEquals(listOf("f", "ba"), indexed)
    }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.ir.symbols.IrReturnableBlockSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrAnonymousInitializerSymbolImpl
import org.jetbrains.kotlin.ir.types.IrSimpleType

Response:
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
import org.jetbrains.kotlin.ir.visitors.acceptVoid
import org.jetbrains.kotlin.utils.memoryOptimizedMap<|endoftext|>


Prompt:
class ComplexExternalDeclarationsUsageLowering(val context: WasmBackendContext) : FileLoweringPass {
    private val nestedExternalToNewTopLevelFunctions = context.mapping.wasmNestedExternalToNewTopLevelFunction
    private val objectToGetInstanceFunctions = context.mapping.wasmExternalObjectToGetInstanceFunction

    override fun lower(irFile: IrFile) {

Response:
irFile.acceptVoid(declarationTransformer)
    }

    private val declarationTransformer = object : IrElementVisitorVoid {
        override fun visitElement(element: IrElement) {
            element.acceptChildrenVoid(this)
        }

        override fun visitFile(declaration: IrFile) {
            process(declaration)
        }<|endoftext|>


Prompt:
* (See `KotlinMultiplatformExtension.applyDefaultHierarchyTemplate`):
     * ```kotlin
     * kotlin {
     *     applyHierarchyTemplate(KotlinHierarchyTemplate.default)
     *     iosX64()
     *     iosArm64()
     *     iosSimulatorArm64()
     *     linuxX64()
     *     // ...

Response:
* }
     * ```
     */
    fun applyHierarchyTemplate(template: KotlinHierarchyTemplate)

    /**
     * Similar to [applyHierarchyTemplate], but allows extension of the provided template.
     *
     * *Examples:*
     *
     * - Add custom groups (Experimental) to additionally share code between Linux and Apple (unixLike):
     *<|endoftext|>


Prompt:
if (!(x !is Class.NestedClass?) || x is Class.NestedClass? || x !is Class.NestedClass?) {
        if (!!(x !is Class.NestedClass?)) {
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!>

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!>.<!UNRESOLVED_REFERENCE!>prop_4<!>
        }
    }
}

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


Prompt:
inner class InterfaceToAbstractClassInnerImpl : InterfaceToAbstractClass
}
class InterfaceToOpenClassContainer {
    open class InterfaceToOpenClassImpl : InterfaceToOpenClass
    class InterfaceToOpenClassImpl2 : InterfaceToOpenClassImpl()
    inner class InterfaceToOpenClassInnerImpl : InterfaceToOpenClass
}
class InterfaceToFinalClassContainer {
    open class InterfaceToFinalClassImpl : InterfaceToFinalClass

Response:
class InterfaceToFinalClassImpl2 : InterfaceToFinalClassImpl()
    inner class InterfaceToFinalClassInnerImpl : InterfaceToFinalClass
}

fun getInterfaceToAbstractClassImpl() = InterfaceToAbstractClassImpl()
inline fun getInterfaceToAbstractClassImplInline() = InterfaceToAbstractClassImpl()
fun getInterfaceToAbstractClassImplAsAny(): Any = InterfaceToAbstractClassImpl()<|endoftext|>


Prompt:
assertFalse(eqFloatQFloatQ(null, 1.toFloat()))
    assertTrue(eqFloatQFloatQ(null, null))
    assertTrue(eqFloatQFloatQ(null, undefined))
    assertFalse(eqFloatQFloatQ(undefined, 0.toFloat()))
    assertFalse(eqFloatQFloatQ(undefined, 1.toFloat()))

Response:
assertTrue(eqFloatQFloatQ(undefined, null))
    assertTrue(eqFloatQFloatQ(undefined, undefined))
    assertTrue(eqFloatDouble(0.toFloat(), 0.toDouble()))
    assertFalse(eqFloatDouble(0.toFloat(), 1.toDouble()))
    assertFalse(eqFloatDouble(1.toFloat(), 0.toDouble()))<|endoftext|>


Prompt:
val functionType = functionSymbol.fir.returnTypeRef.probablyJavaTypeRefToConeType()
                functionType.isSubtypeOf(propertyType, session)
            }
            gettersAreSame
        }

        if (getterDescriptorMatches && this.isVal) return true

Response:
val setterDescriptorMatches = accessorDescriptors.any { (_, setterJvmDescriptor) ->
            currentJvmDescriptor == setterJvmDescriptor
        }

        if (!setterDescriptorMatches) return false

        val (getterOverride, setterOverride) = when (getterDescriptorMatches) {<|endoftext|>


Prompt:
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE
// FILE: A.java
public class A {
    static byte foo = 1;
    static int bar = 2;
}

// FILE: B.java
public class B extends A {}

// FILE: C.java
public class C {
    static long bar = 3;
}

// FILE: 1.kt

Response:
import A.foo
import B.bar

class E: A() {
    init {
        foo
        bar
    }
}

class F: B() {
    init {
        foo
        bar
    }
}

// FILE: 2.kt
import C.bar

class Z: A() {
    init {
        val a: Int = bar
    }
}<|endoftext|>


Prompt:
binaryOperation(SHORT, SHORT, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }),
        binaryOperation(SHORT, BYTE, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }),

Response:
binaryOperation(SHORT, DOUBLE, "div", { a, b -> a.div(b) }, emptyBinaryFun),
        binaryOperation(SHORT, FLOAT, "div", { a, b -> a.div(b) }, emptyBinaryFun),<|endoftext|>


Prompt:
* Skip reachability check, can lead to mysterious crashes in an application.
     * USE UNSAFE MODE ONLY IF ABSOLUTELY SURE WHAT YOU'RE DOING!!!
     */
    UNSAFE(1)
}

/**
 * Detached object graph encapsulates transferrable detached subgraph which cannot be accessed
 * externally, until it is attached with the [attach] extension function.
 */
@Frozen

Response:
@FreezingIsDeprecated
@ObsoleteWorkersApi
public class DetachedObjectGraph<T> internal constructor(pointer: NativePtr) {
    @PublishedApi
    internal val stable: AtomicNativePtr = AtomicNativePtr(pointer)

    /**
     * Creates stable pointer to object, ensuring associated object subgraph is disjoint in specified mode
     * ([TransferMode.SAFE] by default).<|endoftext|>


Prompt:
continuationBlock(context.ir.symbols.throwable.owner.defaultType, endLocationInfoFromScope()) {
                    genHandler(it.value)
                }
            }
        }

        private fun endLocationInfoFromScope(): LocationInfo? {
            val functionScope = currentCodeContext.functionScope()
            val irFunction = functionScope?.let {
                (functionScope as FunctionScope).declaration

Response:
}
            return irFunction?.endLocation
        }

        private fun FunctionGenerationContext.jumpToHandler(exception: LLVMValueRef) {
            jump(handler, exception)
        }

        /**
         * Generates the LLVM `landingpad` that catches C++ exception with type `KotlinException`,
         * unwraps the Kotlin exception object and jumps to [handler].
         *<|endoftext|>


Prompt:
// !LANGUAGE: -OverloadResolutionByLambdaReturnType
// ALLOW_KOTLIN_PACKAGE
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_EXPRESSION
// ISSUE: KT-11265

// FILE: OverloadResolutionByLambdaReturnType.kt

package kotlin

Response:
annotation class OverloadResolutionByLambdaReturnType

// FILE: main.kt

import kotlin.OverloadResolutionByLambdaReturnType

@OverloadResolutionByLambdaReturnType
fun create(f: (Int) -> Int): Int = 1
fun create(f: (Int) -> String): String = ""

fun takeString(s: String) {}<|endoftext|>


Prompt:
override fun bar(): X = X('K')
}

fun box(): String {
    val t: IFoo = TestX()
    val tFoo = t.foo()
    if (tFoo !is X) {
        throw AssertionError("X expected: $tFoo")
    }

Response:
return (t.foo() as X).x.toString() + t.bar().x.toString()
}<|endoftext|>


Prompt: if (w != null || <!SENSELESS_COMPARISON!>this.w != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number & kotlin.Number?")!>this.w<!>.funNullableAny()

Response:
if (w != null || <!SENSELESS_COMPARISON!>this.w != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number & kotlin.Number?")!>this.w<!>

        s = null<|endoftext|>


Prompt:
/** Subtracts the other value from this value. */
    @kotlin.internal.InlineOnly
    public inline operator fun minus(other: UShort): UInt = this.minus(other.toUInt())
    /** Subtracts the other value from this value. */
    @kotlin.internal.InlineOnly

Response:
public inline operator fun minus(other: UInt): UInt = UInt(this.data.minus(other.data))
    /** Subtracts the other value from this value. */
    @kotlin.internal.InlineOnly
    public inline operator fun minus(other: ULong): ULong = this.toULong().minus(other)

    /** Multiplies this value by the other value. */<|endoftext|>


Prompt:
package kotlin.reflect.jvm.internal.calls

import java.lang.reflect.Type

internal object ThrowingCaller : Caller<Nothing?> {
    override val member: Nothing?
        get() = null

    override val parameterTypes: List<Type>
        get() = emptyList()

    override val returnType: Type
        get() = Void.TYPE

Response:
override fun call(args: Array<*>): Any? {
        throw UnsupportedOperationException("call/callBy are not supported for this declaration.")
    }
}<|endoftext|>


Prompt:
printer.println()
        }
        printer.popIndent()
        printer.println(">")
    }

    override fun visitConditionalEffectDeclaration(conditionalEffect: KtConditionalEffectDeclaration<ConeKotlinType, ConeDiagnostic>, data: Nothing?) {
        conditionalEffect.effect.accept(this, data)
        printer.print(" -> ")

Response:
conditionalEffect.condition.accept(this, data)
    }

    override fun visitReturnsEffectDeclaration(returnsEffect: KtReturnsEffectDeclaration<ConeKotlinType, ConeDiagnostic>, data: Nothing?) {
        printer.print("Returns(")
        returnsEffect.value.accept(this, data)
        printer.print(")")
    }<|endoftext|>


Prompt:
environment.getSourceFiles(),
            irProviders = listOf(irDeserializer),
            linkerExtensions = pluginExtensions,
    )

    irDeserializer.postProcess(inOrAfterLinkageStep = true)

    // Enable lazy IR genration for newly-created symbols inside BE
    stubGenerator.unboundSymbolGeneration = true

Response:
messageLogger.checkNoUnboundSymbols(symbolTable, "at the end of IR linkage process")

    mainModule.acceptVoid(ManglerChecker(KonanManglerIr, Ir2DescriptorManglerAdapter(KonanManglerDesc)))

    val modules = if (isProducingLibrary) emptyMap() else (irDeserializer as KonanIrLinker).modules<|endoftext|>


Prompt:
* The following restrictions are imposed:
         *
         * - The only allowed non-time designator is days (`D`). `Y` (years), `W` (weeks), and `M` (months) are not supported.
         * - Day is considered to be exactly 24 hours (24-hour clock time scale).
         * - Alternative week-based representation `["P"][number]["W"]` is not supported.

Response:
*
         * @throws IllegalArgumentException if the string doesn't represent a duration in ISO-8601 format.
         * @sample samples.time.Durations.parseIsoString
         */
        public fun parseIsoString(value: String): Duration = try {
            parseDuration(value, strictIso = true)
        } catch (e: IllegalArgumentException) {<|endoftext|>


Prompt:
* but when it comes to the platform originated member, it's more correct to use platform specific rules, too
 *
 * Initial reason for that checker introduction is smart-cast to raw type:
 * it makes initial type's member incompatible with raw-type's one when regular overridability rules are used,
 * while in Java class they would be treated equally.
 */

Response:
class FirIntersectionScopeOverrideChecker(session: FirSession) : FirOverrideChecker {
    private val standardOverrideChecker = session.firOverrideChecker
    private val platformSpecificOverridabilityRules = session.platformSpecificOverridabilityRules

    override fun isOverriddenFunction(overrideCandidate: FirSimpleFunction, baseDeclaration: FirSimpleFunction): Boolean {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.plugin.ide.IdeDependencyResolver
import org.jetbrains.kotlin.gradle.plugin.usageByName
import org.jetbrains.kotlin.gradle.utils.named

Response:
import org.jetbrains.kotlin.gradle.utils.setAttribute

/**
 * Resolves dependencies of jvm and Android source sets from the perspective jvm
 */
internal fun IdeJvmAndAndroidPlatformBinaryDependencyResolver(project: Project): IdeDependencyResolver =
    IdeBinaryDependencyResolver(<|endoftext|>


Prompt:
if (value_5.case_6_4(value_6) == null) {
        <!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(value_5.<!UNRESOLVED_REFERENCE!>inv<!>())

Response:
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(value_6.<!UNRESOLVED_REFERENCE!>toByte<!>())
    }
}

// TESTCASE NUMBER: 7<|endoftext|>


Prompt:
fun call0(f: (String) -> String, x: String): String = f(x)
fun call1(f: (String, String) -> String, x: String, y: String): String = f(x, y)
fun call2(f: (String, String, String) -> String, x: String, y: String, z: String): String = f(x, y, z)

fun box(): String {

Response:
var s = "1"

    fun foo(x: String, y: String = "5", z: String = "4"): String = s + x + y + z

    val r = call1(::foo, "2", "3")
    if (r != "1234") return "FAIL $r"<|endoftext|>


Prompt:
val f: Boolean = true
private fun doUpdateRegularTasks() {
    try {
        while (f) {
            val xmlText = <!UNRESOLVED_REFERENCE!>getText<!>()
            if (xmlText == null) {}
            else {
                xmlText.<!UNRESOLVED_REFERENCE!>value<!> = 0 // !!!
            }
        }

Response:
}
    finally {
        fun execute() {}
    }
}<|endoftext|>


Prompt:
suspend fun <T> fooReturnLong(x: T): Long = 1L
suspend fun Int.suspendToString(): String = toString()

suspend inline fun <reified T, reified R> check(x: T, y: R, f: suspend (T) -> R, tType: String, rType: String) {
    assertEquals(tType, T::class.simpleName)

Response:
assertEquals(rType, R::class.simpleName)
}

suspend inline fun <reified T, reified R> check(f: suspend (T) -> R, g: suspend (T) -> R, tType: String, rType: String) {
    assertEquals(tType, T::class.simpleName)
    assertEquals(rType, R::class.simpleName)
}<|endoftext|>


Prompt:
open class AChar(vararg val x: Char)
class BChar : AChar()

open class ALong(vararg val x: Long)
class BLong : ALong()

open class AFloat(vararg val x: Float)
class BFloat : AFloat()

open class ADouble(vararg val x: Double)
class BDouble : ADouble()

Response:
open class AUByte(vararg val x: UByte)
class BUByte : AUByte()

open class AUShort(vararg val x: UShort)
class BUShort : AUShort()

open class AUInt(vararg val x: UInt)
class BUInt : AUInt()

open class AULong(vararg val x: ULong)
class BULong : AULong()<|endoftext|>


Prompt:
@Test
    fun readDifferentOffsetAndLength() {
        val repeat = 10_000
        val symbols = "Zm9vYmFy".repeat(repeat) + "Zm8="
        val expected = "foobar".repeat(repeat) + "fo"

        val bytes = ByteArray(expected.length)

        symbols.byteInputStream().decodingWith(Base64).use { input ->

Response:
var read = 0
            repeat(6) {
                bytes[read++] = input.read().toByte()
            }

            var toRead = 1
            while (read < bytes.size) {
                val length = minOf(toRead, bytes.size - read)
                val result = input.read(bytes, read, length)

                assertEquals(length, result)

                read += result<|endoftext|>


Prompt:
}
    */

    @Test fun split() = withOneCharSequenceArg { arg1 ->
        operator fun String.unaryPlus(): CharSequence = arg1(this)

        assertEquals(listOf(""), (+"").split(";"))
        assertEquals(listOf("test"), (+"test").split(*charArrayOf()), "empty list of delimiters, none matched -> entire string returned")

Response:
assertEquals(listOf("test"), (+"test").split(*arrayOf<String>()), "empty list of delimiters, none matched -> entire string returned")

        assertEquals(listOf("abc", "def", "123;456"), (+"abc;def,123;456").split(';', ',', limit = 3))<|endoftext|>


Prompt:
require(cBoolType != null) { renderCompilerError(location) }
        BooleanValuePassing(cBoolType, irBuiltIns)
    }

    type.isByte() -> TrivialValuePassing(irBuiltIns.byteType, CTypes.signedChar)
    type.isShort() -> TrivialValuePassing(irBuiltIns.shortType, CTypes.short)

Response:
type.isInt() -> TrivialValuePassing(irBuiltIns.intType, CTypes.int)
    type.isLong() -> TrivialValuePassing(irBuiltIns.longType, CTypes.longLong)
    type.isFloat() -> TrivialValuePassing(irBuiltIns.floatType, CTypes.float)<|endoftext|>


Prompt: if (<!DEPRECATED_IDENTITY_EQUALS!>a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> null === true<!>) {

Response: if (<!DEPRECATED_IDENTITY_EQUALS!>a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> !== null === <!USELESS_IS_CHECK!>true !is Boolean<!><!> == true) {<|endoftext|>


Prompt:
try {
            if (restricted.setReadable(false)) {
                if (File(basedir, "7.txt").setReadable(false)) {
                    assertFalse(basedir.deleteRecursively(), "Expected incomplete recursive deletion.")
                    restricted.setReadable(true)
                    File(basedir, "7.txt").setReadable(true)
                    var i = 0

Response:
for (file in basedir.walkTopDown()) {
                        i++
                    }
                    assertEquals(6, i)
                }
            }
        } finally {
            restricted.setReadable(true)
            File(basedir, "7.txt").setReadable(true)
            basedir.deleteRecursively()
        }
    }<|endoftext|>


Prompt: if (e != null || <!SENSELESS_COMPARISON!>this.e != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char & kotlin.Char?")!>this.e<!>.propNullableAny

Response: if (e != null || <!SENSELESS_COMPARISON!>this.e != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char"), DEBUG_INFO_SMARTCAST!>this.e<!>.funT()<|endoftext|>


Prompt:
&& receiver?.canInline(visibleScopes) != false
        }
        is IrCall -> {
            // Same applies to reads of properties with default getters, but non-final properties may be overridden by `var`s:
            val callee = symbol.owner
            callee.isFinalDefaultValGetter && callee.fileParentOrNull.let { it != null && it in visibleScopes }

Response:
&& dispatchReceiver?.canInline(visibleScopes) != false
                    && extensionReceiver?.canInline(visibleScopes) != false
        }
        else -> {
            // Constants and singleton object accesses are always stable:
            isTrivial()
        }
    }

    private val IrSimpleFunction.isFinalDefaultValGetter: Boolean<|endoftext|>


Prompt:
element: FirDeclaration,
        containingMemberDeclaration: FirMemberDeclaration?,
        context: CheckerContext,
        reporter: DiagnosticReporter
    ) = checkElementAndReport(
        element,
        element.implicitVisibility(context),
        containingMemberDeclaration,
        context,
        reporter
    )

    private fun checkElementAndReport(
        element: FirDeclaration,

Response:
implicitVisibility: Visibility,
        containingMemberDeclaration: FirMemberDeclaration?,
        context: CheckerContext,
        reporter: DiagnosticReporter
    ) {
        if (element.source?.kind is KtFakeSourceElementKind) {
            return
        }

        if (element !is FirMemberDeclaration) {
            return
        }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.constants.*
import org.jetbrains.kotlin.types.error.ErrorUtils
import org.jetbrains.kotlin.types.KotlinType

Response:
class AnnotationDeserializer(private val module: ModuleDescriptor, private val notFoundClasses: NotFoundClasses) {
    private val builtIns: KotlinBuiltIns
        get() = module.builtIns

    fun deserializeAnnotation(proto: Annotation, nameResolver: NameResolver): AnnotationDescriptor {<|endoftext|>


Prompt:
PARAGRAPH_SEPARATOR(Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR.toInt()),

    /**
     * Neutral bidirectional character type "S" in the Unicode specification.
     */
    SEGMENT_SEPARATOR(Character.DIRECTIONALITY_SEGMENT_SEPARATOR.toInt()),

    /**

Response:
* Neutral bidirectional character type "WS" in the Unicode specification.
     */
    WHITESPACE(Character.DIRECTIONALITY_WHITESPACE.toInt()),

    /**
     * Neutral bidirectional character type "ON" in the Unicode specification.
     */
    OTHER_NEUTRALS(Character.DIRECTIONALITY_OTHER_NEUTRALS.toInt()),<|endoftext|>


Prompt:
return dependenciesToAdd[declaration.name]?.toList() ?: listOf()
    }

    fun getNamedDeclarationsToAdd(fileName: String): List<IDLUnionDeclaration> {
        return namedDeclarationsToAdd[fileName]?.toList() ?: listOf()
    }

    private fun processUnionType(unionType: IDLUnionTypeDeclaration) {

Response:
val newDependenciesToAdd: MutableMap<String, MutableSet<IDLSingleTypeDeclaration>> = mutableMapOf()
        for (member in unionType.unionMembers) {
            when (member) {
                is IDLUnionTypeDeclaration -> {
                    if (member.name !in resolvedUnionTypes && member.name !in failedToResolveUnionTypes) {
                        processUnionType(member)<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.expressions.FirPropertyAccessExpression
import org.jetbrains.kotlin.fir.expressions.UnresolvedExpressionTypeAccess

Response:
import org.jetbrains.kotlin.fir.references.FirReference
import org.jetbrains.kotlin.fir.types.ConeKotlinType
import org.jetbrains.kotlin.fir.types.FirTypeProjection
import org.jetbrains.kotlin.fir.visitors.FirTransformer<|endoftext|>


Prompt:
import org.jetbrains.kotlin.ir.backend.js.generateModuleFragmentWithPlugins
import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsIrLinker
import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsManglerDesc

Response:
import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsManglerIr
import org.jetbrains.kotlin.ir.declarations.IrFactory
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.linkage.partial.partialLinkageConfig<|endoftext|>


Prompt:
private fun FirSymbolProvider.findPropertyCandidates(property: KtProperty): List<FirPropertySymbol> =
        findCallableCandidates(property, property.isTopLevel).filterIsInstance<FirPropertySymbol>()

    private fun FirSymbolProvider.findCallableCandidates(
        declaration: KtCallableDeclaration,
        isTopLevel: Boolean,

Response:
): List<FirCallableSymbol<*>> {
        val shortName = declaration.nameAsSafeName

        if (isTopLevel) {
            val packageFqName = declaration.containingKtFile.packageFqName

            @OptIn(FirSymbolProviderInternals::class)
            return when (this) {
                is LLFirModuleWithDependenciesSymbolProvider -> buildList {<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_VARIABLE

fun <R> myRun(b: () -> R): R = b()

fun <T> materialize(): T = TODO()

fun foo(x: String?) {
    val r = myRun {
        val y = x ?: return@myRun materialize()
        y.length
    }

    r.minus(1)

Response: }<|endoftext|>


Prompt:
* The result is either zero or has the same sign as the _divisor_ and has the absolute value less than the absolute value of the divisor.
 */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Byte.mod(other: Long): Long =

Response:
this.toLong().mod(other)

/** Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. */
@SinceKotlin("1.5")
@kotlin.internal.InlineOnly
@kotlin.internal.IntrinsicConstEvaluation
public inline fun Short.floorDiv(other: Byte): Int =<|endoftext|>


Prompt:
public inline fun <R> kotlin.UIntArray.foldRightIndexed(initial: R, operation: (index: kotlin.Int, kotlin.UInt, acc: R) -> R): R

@kotlin.SinceKotlin(version = "1.3")
@kotlin.ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly

Response:
public inline fun <R> kotlin.ULongArray.foldRightIndexed(initial: R, operation: (index: kotlin.Int, kotlin.ULong, acc: R) -> R): R

@kotlin.SinceKotlin(version = "1.3")
@kotlin.ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly<|endoftext|>


Prompt:
// FILE: foo/Super.java
package foo

public abstract class Super<T> {
    protected abstract String getName();
    protected abstract void setName(String s);

    protected abstract String getName2();
    protected abstract void setName2(String s);

    protected abstract void doSomething();
    protected abstract void doSomething2();
}

// FILE: bar/Sub.kt
package bar

Response:
abstract class Sub<T>: foo.Super<T>() {
    abstract override fun getName(): String
    abstract override fun setName(s: String)
    abstract override fun doSomething()
}

// FILE: foo/test.kt
package foo

fun test(s: bar.Sub<String>) {
    s.<!INVISIBLE_REFERENCE!>name<!><|endoftext|>


Prompt:
assert(rangeLiteral.isLowInclusive && rangeLiteral.isHighInclusive) { "Floating point range literal bounds should be inclusive" }
    }

    private val isNotIn = operatorReference.getReferencedNameElementType() == KtTokens.NOT_IN

    override fun generate(argument: StackValue): BranchedValue =

Response:
gen(argument).let { if (isNotIn) Invert(it) else it }

    private fun gen(argument: StackValue): BranchedValue =
        object : BranchedValue(argument, null, comparisonGenerator.comparedType, Opcodes.IFEQ) {
            override fun condJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {<|endoftext|>


Prompt:
warnAboutTargetFromPresetDeprecation()
        return targetFromPresetInternal(
            preset = preset,
            name = name,
            configure = configure,
        )
    }

    @DeprecatedTargetPresetApi
    @Deprecated(
        KotlinToolingDiagnostics.TargetFromPreset.DEPRECATION_MESSAGE,
        level = DeprecationLevel.WARNING

Response:
)
    fun <T : KotlinTarget> targetFromPreset(
        preset: KotlinTargetPreset<T>,
        name: String,
        configure: Action<T>,
    ): T {
        warnAboutTargetFromPresetDeprecation()
        return targetFromPresetInternal(
            preset = preset,
            name = name,
            configure = configure,
        )
    }<|endoftext|>


Prompt:
useSiteSession,
            scopeSession,
            memberRequiredPhase = FirResolvePhase.TYPES,
        )

        fun getStaticScope() = JavaScopeProvider.getStaticScope(firJavaClass, useSiteSession, scopeSession)

        val firScope = when (kind) {

Response:
// `FirExcludingNonInnerClassesScope` is a workaround for non-static member scopes containing static classes (see KT-61900).
            DeclaredMemberScopeKind.NON_STATIC -> FirExcludingNonInnerClassesScope(getBaseUseSiteScope())

            DeclaredMemberScopeKind.STATIC -> getStaticScope() ?: return null<|endoftext|>


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

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

Response:
public inline fun maxOf(a: kotlin.ULong, b: kotlin.ULong, c: kotlin.ULong): kotlin.ULong

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


Prompt:
fun case_2() {
    val x = object<!TYPE_PARAMETERS_IN_ANONYMOUS_OBJECT!><T : Number, K: Comparable<K>><!> { }
}

fun case_3() {

Response: val x = object<!TYPE_PARAMETERS_IN_ANONYMOUS_OBJECT!><T><!> <!SYNTAX!>where <!DEBUG_INFO_MISSING_UNRESOLVED!>T<!> :<|endoftext|>


Prompt:
// Do not report NAME_SHADOWING on lambda destructured parameter, the same way as for common parameters
    foo { (a, b) ->
        a checkType { _<Int>() }
        b checkType { _<String>() }
    }

    foo { (c, d) ->
        c checkType { _<Int>() }
        d checkType { _<String>() }

Response:
foo { (a, c) ->
            a checkType { _<Int>() }
            c checkType { _<String>() }
            d checkType { _<String>() }
        }
    }
}<|endoftext|>


Prompt:
// ISSUE: KT-53752
// INFERENCE_HELPERS

interface A
interface B {
    fun fooB(x: Int): String
}

class Foo

fun test(ab: A) {
    if (ab is B) {
        var z = id(ab) // materialize smartcast

Response:
z = <!ASSIGNMENT_TYPE_MISMATCH!>Foo()<!> // unsafe assignment
        z.fooB(1)
    }
}<|endoftext|>


Prompt:
val RENDERBUFFER_INTERNAL_FORMAT: Int
        val RENDERBUFFER_RED_SIZE: Int
        val RENDERBUFFER_GREEN_SIZE: Int
        val RENDERBUFFER_BLUE_SIZE: Int
        val RENDERBUFFER_ALPHA_SIZE: Int
        val RENDERBUFFER_DEPTH_SIZE: Int

Response:
val RENDERBUFFER_STENCIL_SIZE: Int
        val FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: Int
        val FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: Int
        val FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: Int
        val FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: Int<|endoftext|>


Prompt:
operator fun get(x: Any, y: Any, z: Any): Any {
        return x
    }
}

class C() {
    operator fun get(function: () -> Any): Any {
        return function()
    }
}

fun box() : String{
    val a = A1(4444)
    val c  = a [C()[{ 1 + 900 }]]

Response:
val x = a[a[a[a[B()[A1(100500)[ C()[{ 1 + 900 }]  ], 'c', false]]]]]

    if (c == 901 && x == 901)
        return "OK"
    return "NOK"
}<|endoftext|>


Prompt:
private val IrClass.needsOfBoxParameter by context.mapping.esClassWhichNeedBoxParameters

    override fun lower(irBody: IrBody, container: IrDeclaration) {
        if (!context.es6mode) return

        val containerFunction = container as? IrFunction

        val shouldRemoveBoxRelatedDeclarationsAndStatements =

Response:
containerFunction?.isEs6ConstructorReplacement == true && !containerFunction.parentAsClass.requiredToHaveBoxParameter()

        if (containerFunction != null && shouldRemoveBoxRelatedDeclarationsAndStatements && irBody is IrBlockBody) {
            containerFunction.valueParameters = containerFunction.valueParameters.memoryOptimizedFilterNot { it.isBoxParameter }
        }<|endoftext|>


Prompt:
group = BenchmarkingPlugin.BENCHMARKING_GROUP
            description = "Builds the benchmarking report for Kotlin/Native."
            doLast { println("JVM run isn't supported") }
            jvmRun.finalizedBy(this)
        }
    }

    override fun apply(target: Project): Unit = with(target) {
        addTimeListener(this)

Response:
val benchmarkExtension = extensions.create(
            COMPILE_BENCHMARK_EXTENSION_NAME,
            CompileBenchmarkExtension::class.java,
            this
        )

        // Create tasks.
        configureUtilityTasks()
        configureKonanRun(benchmarkExtension)
        configureJvmRun()
    }

    companion object {<|endoftext|>


Prompt:
internal class HashMapValuesDefault<K, V>(private val backingMap: AbstractMutableMap<K, V>) : AbstractMutableCollection<V>() {
    override fun add(element: V): Boolean = throw UnsupportedOperationException("Add is not supported on values")
    override fun clear() = backingMap.clear()

    override operator fun contains(element: V): Boolean = backingMap.containsValue(element)

Response:
override operator fun iterator(): MutableIterator<V> {
        val entryIterator = backingMap.entries.iterator()
        return object : MutableIterator<V> {
            override fun hasNext(): Boolean = entryIterator.hasNext()
            override fun next(): V = entryIterator.next().value
            override fun remove() = entryIterator.remove()
        }
    }<|endoftext|>


Prompt:
package org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve

import org.jetbrains.kotlin.analysis.low.level.api.fir.util.forEachDeclaration
import org.jetbrains.kotlin.fir.declarations.FirFile

Response:
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
import org.jetbrains.kotlin.fir.declarations.FirScript

/**
 * In opposite to [NonLocalAnnotationVisitor] processes not only the target declaration,
 * but also its nested declarations.
 *
 * @see NonLocalAnnotationVisitor
 */<|endoftext|>


Prompt:
* This class contains Java-related overridability conditions that may force incompatibility
 */
class JavaIncompatibilityRulesOverridabilityCondition : ExternalOverridabilityCondition {
    override fun isOverridable(
        superDescriptor: CallableDescriptor,
        subDescriptor: CallableDescriptor,
        subClassDescriptor: ClassDescriptor?
    ): Result {

Response:
if (isIncompatibleInAccordanceWithBuiltInOverridabilityRules(superDescriptor, subDescriptor, subClassDescriptor)) {
            return Result.INCOMPATIBLE
        }

        if (doesJavaOverrideHaveIncompatibleValueParameterKinds(superDescriptor, subDescriptor)) {
            return Result.INCOMPATIBLE
        }

        return Result.UNKNOWN
    }<|endoftext|>


Prompt:
var a: Int
    fun foo(): Int
    fun bar(o: Int)
}

interface KotlinInterface2 {
    var a: Int
    fun foo(): Any
    fun bar(o: Any)
}

fun test(a: A, b: B, c: C, d: D, e: E, f: F, g: G) {
    val k1: Int = a.foo()

Response:
val k2: Unit = a.bar(1)
    val k3: Unit = a.bar("")
    val k4: Unit = a.bar(null)
    val k5: Int = b.foo()
    val k6: Unit = b.bar(1)
    val k7: Unit = b.bar("")
    val k8: Unit = b.bar(null)<|endoftext|>


Prompt:
x[1] <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> {
        someCallInsideLambda()
        "please choose String"
    }
}

// only plus, no set. 3 indices in get/set
class G {
    operator fun get(i: Int, j: Int, k: Int): G = this

Response:
operator fun set(i: Int, j: Int, k: Int, x: G) {}
    operator fun plus(v: () -> Unit): G = this
}

fun test_7(x: G) {
    x[1, 2, 3] += {
        someCallInsideLambda()
        x[1, 2, 3] += {
            someCallInsideLambda()
            Unit
        }<|endoftext|>


Prompt:
fun withAssertion(j: J) = generic<String?>(j)

fun <T> generic(j: J) = j.nullT<T>()

// FILE: J.java
import org.jetbrains.annotations.NotNull;

public class J {
    @NotNull
    public <T> T nullT() {
        return null;
    }

    public void test() {

Response:
TestKt.withAssertion(this);
    }
}<|endoftext|>


Prompt:
interface IBar {
    suspend fun bar(): I
}

class Test() : IBar {
    override suspend fun bar(): IC = IC(Wrapper("OK"))

    suspend fun test1(): String {
        val b: IBar = this
        return ((b.bar() as IC).i as Wrapper).s
    }

Response:
suspend fun test2(): String = ((bar() as IC).i as Wrapper).s
}

fun box(): String {
    var result = "FAIL 1"
    builder {
        result = Test().test1()
    }
    if (result != "OK") return "FAIL 1 $result"

    result = "FAIL2 "
    builder {
        result = Test().test2()
    }<|endoftext|>


Prompt:
0x7ff8000000000000UL,     0x7ff8000000000000UL,     0x7ff8000000000000UL,     0x7ff8000000000000UL,
            0x7ff8000000000000UL,     0x7ff8000000000000UL,     0x7ff8000000000000UL,     0x7ff8000000000000UL,

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


Prompt:
import org.jetbrains.kotlin.metadata.deserialization.VersionRequirement

class K1JvmVersionRequirementTest : AbstractJvmVersionRequirementTest() {
    fun testAllJvmDefault() {
        doTest(
            VersionRequirement.Version(1, 4, 0), DeprecationLevel.ERROR, null,

Response:
ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION, null,
            analysisFlags = mapOf(JvmAnalysisFlags.jvmDefaultMode to JvmDefaultMode.ALL),
            fqNamesWithRequirements = listOf(
                "test.Base",
                "test.Derived",
                "test.BaseWithProperty",
                "test.DerivedWithProperty",
                "test.Empty",<|endoftext|>


Prompt:
this.inferenceSession = inferenceSession
        return try {
            inferenceSession.block()
        } finally {
            this.inferenceSession = oldSession
        }
    }

    @OptIn(PrivateForInline::class)
    inline fun <T> withAnonymousFunctionTowerDataContext(symbol: FirAnonymousFunctionSymbol, f: () -> T): T {

Response:
return withTemporaryRegularContext(specialTowerDataContexts.getAnonymousFunctionContext(symbol), f)
    }

    @OptIn(PrivateForInline::class)
    inline fun <T> withCallableReferenceTowerDataContext(access: FirCallableReferenceAccess, f: () -> T): T {<|endoftext|>


Prompt:
"Do not sort class members in output abi.jar. Legacy flag that allows tools that rely on methods/fields order in the source" +
                        " to keep working. Flipping this to true reduces stability of the ABI.",
                false,
            )

        val REMOVE_PRIVATE_CLASSES_OPTION: CliOption =
            CliOption(
                "removePrivateClasses",

Response:
"true/false",
                "Remove private classes from ABI. False by default due to backwards compatibility. If enabled, " +
                        "private top-level classes will no longer be available from Java classes in the same package.",
                false,
            )
        val TREAT_INTERNAL_AS_PRIVATE_OPTION: CliOption =
            CliOption(
                "treatInternalAsPrivate",<|endoftext|>


Prompt:
override fun lower(irFile: IrFile) {
        addContinuationObjectAndContinuationParameterToSuspendFunctions(irFile)
        addContinuationParameterToSuspendCalls(irFile)
    }

    private fun addContinuationParameterToSuspendCalls(irFile: IrFile) {
        irFile.transformChildrenVoid(object : IrElementTransformerVoid() {

Response:
val functionStack = mutableListOf<IrFunction>()

            override fun visitFunction(declaration: IrFunction): IrStatement {
                functionStack.push(declaration)
                return super.visitFunction(declaration).also { functionStack.pop() }
            }

            override fun visitFunctionReference(expression: IrFunctionReference): IrExpression {<|endoftext|>


Prompt:
val podLibrary = projectPath.resolve(customPodLibraryName)
            val privateSpecGit = projectPath.resolve(privateSpecGitRepo)
            val privateSpecGitUri = privateSpecGit.toUri().toString()

            buildGradleKts.addSpecRepo(privateSpecGitUri)

            fun podInstallSynthetic(version: String) {

Response:
buildGradleKts.addPod(customPodLibraryName, "version = \"$version\"")
                build(defaultPodGenTaskName) {
                    assertTasksExecuted(defaultPodGenTaskName)
                }

                build(defaultPodInstallSyntheticTaskName) {
                    assertTasksExecuted(defaultPodInstallSyntheticTaskName)
                }<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_PARAMETER
enum class A {
    W(1), X(1, 2), Y(3.0), Z(""), E();

    constructor()
    constructor(x: Int)
    constructor(x: Int, y: Int): this(x+y)
    constructor(x: Double): this(x.toInt(), 1)

Response:
constructor(x: String): <!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR!>super<!>(x, 1)
}

enum class B(x: Int) {
    W(1), X(1, 2), Y(3.0), Z("");

    constructor(x: Int, y: Int): this(x+y)<|endoftext|>


Prompt:
package org.jetbrains.kotlin.incremental.storage

import com.intellij.util.io.DataExternalizer
import org.jetbrains.kotlin.incremental.IncrementalCompilationContext
import org.jetbrains.kotlin.name.FqName
import java.io.DataInput
import java.io.DataOutput
import java.io.File

Response:
internal data class ICClassesAttributes(val isSealed: Boolean)

internal object ICClassesAttributesExternalizer : DataExternalizer<ICClassesAttributes> {
    override fun read(input: DataInput): ICClassesAttributes {
        return ICClassesAttributes(input.readBoolean())
    }

    override fun save(output: DataOutput, value: ICClassesAttributes) {<|endoftext|>


Prompt:
assertFalse("strö".endsWith("RÖ", ignoreCase = false))
        assertTrue("strö".endsWith("RÖ", ignoreCase = true))
        assertFalse("".endsWith("a"))
        assertTrue("some".endsWith(""))
        assertTrue("".endsWith(""))
    }

Response:
@Test fun endsWithStringForCharSequence() = withTwoCharSequenceArgs { arg1, arg2 ->
        fun String.endsWithCs(suffix: String, ignoreCase: Boolean = false): Boolean =
            arg1(this).endsWith(arg2(suffix), ignoreCase)

        assertTrue("abcd".endsWithCs("d"))
        assertTrue("abcd".endsWithCs("abcd"))<|endoftext|>


Prompt:
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.test.compileJavaFilesExternally
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives

Response:
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.USE_JAVAC_BASED_ON_JVM_TARGET
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.*
import org.jetbrains.kotlin.test.services.jvm.compiledClassesManager<|endoftext|>


Prompt:
// !LANGUAGE: +AllowContractsForCustomFunctions +ReadDeserializedContracts
// !OPT_IN: kotlin.contracts.ExperimentalContracts
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")

package test

import kotlin.contracts.*

fun foo(x: Any?): Boolean {
    contract {

Response:
returns() implies (x is String)
    }
    return bar(x)
}

fun bar(x: Any?): Boolean {
    contract {
        returns() implies (x is Int)
    }
    return foo(x)
}<|endoftext|>


Prompt:
IS_NOINLINE.toFlags(isNoinline) or
            IS_CROSSINLINE.toFlags(isCrossinline)

    override val isVararg get() = IS_VARARG.get(flags)
    override val hasDefaultArg get() = HAS_DEFAULT_ARG.get(flags)
    override val isNoinline get() = IS_NOINLINE.get(flags)

Response:
override val isCrossinline get() = IS_CROSSINLINE.get(flags)

    companion object {
        private val IS_VARARG = FlagField.booleanFirst()
        private val HAS_DEFAULT_ARG = FlagField.booleanAfter(IS_VARARG)
        private val IS_NOINLINE = FlagField.booleanAfter(HAS_DEFAULT_ARG)<|endoftext|>


Prompt:
session, scopeSession, declaration, Interner(typeParameters), extension,
            typeTable, versionRequirementTable, serializeTypeTableToFunction = false,
            typeApproximator, languageVersionSettings, produceHeaderKlib
        )

    val stringTable: FirElementAwareStringTable
        get() = extension.stringTable

    private fun useTypeTable(): Boolean = extension.shouldUseTypeTable()

Response:
private fun MutableVersionRequirementTable.serializeVersionRequirements(container: FirAnnotationContainer): List<Int> =
        serializeVersionRequirements(container.annotations)

    private fun MutableVersionRequirementTable.serializeVersionRequirements(annotations: List<FirAnnotation>): List<Int> =
        annotations
            .filter {<|endoftext|>


Prompt:
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// WITH_STDLIB
// FILE: inlined.kt

suspend inline fun inlineMe(c: suspend () -> Unit) {
    c()
    c()
    c()
    c()
    c()
}
suspend inline fun noinlineMe(noinline c: suspend () -> Unit) {
    c()

Response:
c()
    c()
    c()
    c()
}
suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
    c()
    c()
    c()
    c()
    c()
}

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

fun builder(c: suspend () -> Unit) {<|endoftext|>


Prompt:
assertTrue(!bs.bitSet(1))
        assertTrue(!bs.bitSet(0))

        assertTrue(bs[0])
        assertTrue(bs.bitClear(0))
        assertTrue(!bs.bitClear(0))

        assertTrue(bs[1])
    }
}

class LockFreeIntBits {
    private val bits = atomic(0)

Response:
private fun Int.mask() = 1 shl this

    operator fun get(index: Int): Boolean = bits.value and index.mask() != 0

    // User-defined private inline function
    private inline fun bitUpdate(check: (Int) -> Boolean, upd: (Int) -> Int): Boolean {
        bits.update {
            if (check(it)) return false
            upd(it)
        }<|endoftext|>


Prompt:
sealed interface SI1 {
    class A : SI1
    class B : SI1
}

sealed class SC1 {
    class A: SC1()
    class B: SC1()
}

enum class E1 {
    A, B
}

enum class E2 {
    A, B
}

sealed interface SI2 {
    class ClassToObject : SI2

Response:
object ObjectToClass : SI2
}

sealed class SC2 {
    class ClassToObject : SC2()
    object ObjectToClass : SC2()
}<|endoftext|>


Prompt:
import org.jetbrains.kotlin.resolve.inline.isInlineOnly
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker

Response:
import org.jetbrains.kotlin.types.typeUtil.constituentTypes
import org.jetbrains.kotlin.types.typeUtil.contains
import org.jetbrains.kotlin.types.typeUtil.isArrayOfNothing
import org.jetbrains.kotlin.types.typeUtil.isNothing

internal class DeclarationsCheckerBuilder(<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl
import org.jetbrains.kotlin.fir.builder.toMutableOrEmpty
import org.jetbrains.kotlin.fir.contracts.FirContractDescription
import org.jetbrains.kotlin.fir.declarations.*

Response:
import org.jetbrains.kotlin.fir.declarations.impl.FirPrimaryConstructor
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
import org.jetbrains.kotlin.fir.expressions.FirBlock
import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall<|endoftext|>


Prompt:
eatEverythingUntilLevel = numberOfNestedBlocks
                addInstruction(op, location, immediates)
                return
            }
        }

        if (lastInstructionIndex == -1) {
            addInstruction(op, location, immediates)
            return
        }

        val lastInstruction = expression[lastInstructionIndex]
        val lastOperator = lastInstruction.operator

Response:
// droppable instructions + drop/unreachable -> nothing
        if ((op == WasmOp.DROP || op == WasmOp.UNREACHABLE) && lastOperator.pureStacklessInstruction()) {
            trimInstructionsUntil(lastInstructionIndex)
            (lastInstruction.location as? SourceLocation.Location)?.let(::buildNop)
            return
        }<|endoftext|>


Prompt:
fun test_2(base: Base): String {
    return when (base) {
        is A -> "Fail A"
        is B.C -> "Fail B.C"
        is B.D -> "K"
        E.First -> "Fail E.First"
        E.Second -> "Fail E.Second"
    }
}

class MyD : B.D

fun box(): String {

Response:
return test_1(E.First) + test_2(MyD())
}<|endoftext|>


Prompt:
package org.jetbrains.kotlin.analysis.project.structure.impl

import com.intellij.ide.highlighter.JavaFileType
import com.intellij.psi.PsiFileSystemItem
import com.intellij.psi.PsiManager

Response:
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtStaticProjectStructureProvider
import org.jetbrains.kotlin.analysis.project.structure.builder.*
import org.jetbrains.kotlin.analyzer.common.CommonPlatformAnalyzerServices<|endoftext|>


Prompt:
protected abstract val multiplatformInfoProviderImpl: KtMultiplatformInfoProvider

    internal val originalPsiProvider: KtOriginalPsiProvider get() = originalPsiProviderImpl
    protected abstract val originalPsiProviderImpl: KtOriginalPsiProvider

    internal val symbolInfoProvider: KtSymbolInfoProvider get() = symbolInfoProviderImpl
    protected abstract val symbolInfoProviderImpl: KtSymbolInfoProvider

Response:
internal val analysisScopeProvider: KtAnalysisScopeProvider get() = analysisScopeProviderImpl
    protected abstract val analysisScopeProviderImpl: KtAnalysisScopeProvider

    internal val referenceResolveProvider: KtReferenceResolveProvider get() = referenceResolveProviderImpl
    protected abstract val referenceResolveProviderImpl: KtReferenceResolveProvider<|endoftext|>


Prompt:
AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)
                        kotlin.wasm.internal.copyWasmArray(this.storage, destination.storage, startIndex, destinationOffset, rangeSize)
                        return destination
                        """
                    }
                }
            }
        }
    }

Response:
val f_copyOfRangeJvmImpl = fn("copyOfRangeImpl(fromIndex: Int, toIndex: Int)") {
        include(InvariantArraysOfObjects, ArraysOfPrimitives)
        platforms(Platform.JVM)
    } builderWith { _ ->
        since("1.3")
        visibility("internal")
        annotation("@PublishedApi")<|endoftext|>


Prompt:
+field("varargElementType", irTypeType, nullable = true)
        +field("isCrossinline", boolean)
        +field("isNoinline", boolean)
        +field("isHidden", boolean) {
            additionalImports.add(idSignatureType)
            kDoc = """
            If `true`, the value parameter does not participate in [IdSignature] computation.

Response:
This is a workaround that is needed for better support of compiler plugins.
            Suppose you have the following code and some IR plugin that adds a value parameter to functions
            marked with the `@PluginMarker` annotation.
            ```kotlin
            @PluginMarker
            fun foo(defined: Int) { /* ... */ }
            ```

            Suppose that after applying the plugin the function is changed to:<|endoftext|>


Prompt:
// WITH_STDLIB
// WITH_COROUTINES

import helpers.*
import kotlin.coroutines.*

inline class IC(val s: Int?)

fun Int?.toResultString() =
    if (this == 42) "OK" else "!! $this"

interface Base<T> {
    suspend fun generic(): T
}

class Derived : Base<IC> {

Response:
override suspend fun generic(): IC = suspendCoroutine { it.resume(IC(42)) }
}

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

fun box(): String {
    var res: String? = null
    builder {
        val base: Base<*> = Derived()<|endoftext|>


Prompt:
strategy.compatibilityRules.add(KotlinCinteropCompatibility::class.java)
            strategy.disambiguationRules.add(KotlinCinteropDisambiguation::class.java)

            if (isKotlinGranularMetadata) {
                strategy.compatibilityRules.add(KotlinMetadataCompatibility::class.java)

Response:
strategy.disambiguationRules.add(KotlinMetadataDisambiguation::class.java)
            }

            // Only enable resources compatibility rule when resources configuration is used, so that for variant reselection klibs aren't selected
            if (isKotlinResourcesCompatibilityRuleEnabled) {
                strategy.compatibilityRules.add(KotlinResourcesCompatibility::class.java)
            }
        }<|endoftext|>


Prompt:
takeByte(<!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>2.rem(1)<!>)
    takeByte(<!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>2 shl 1<!>)
    takeByte(<!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>2 shr 1<!>)

Response:
takeByte(<!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>2 ushr 1<!>)

    takeByte(<!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>2 and 1<!>)
    takeByte(<!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>2 or 1<!>)<|endoftext|>


Prompt:
makeTypeProjection(type, variance)
            ), annotations = emptyList()
        )
    }

    internal fun IrClass.addCachedChildSerializersProperty(cacheableSerializers: List<IrExpression?>): IrProperty? {
        // if all child serializers are null (non-cacheable) we don't need to create a property

Response:
cacheableSerializers.firstOrNull { it != null } ?: return null

        val kSerializerClass = compilerContext.kSerializerClass
            ?: error("Serializer class '$KSERIALIZER_NAME_FQ' not found. Check that the kotlinx.serialization runtime is connected correctly")<|endoftext|>


Prompt:
if (!(element5 !in charSequence.indices) != range0.contains(element5)) throw AssertionError()
}

fun testR0xE6() {
    // with possible local optimizations
    if (0 in charSequence.indices != range0.contains(0)) throw AssertionError()

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


Prompt:
package org.jetbrains.kotlin.cli.metadata

import org.jetbrains.kotlin.metadata.builtins.BuiltInsBinaryVersion
import org.jetbrains.kotlin.serialization.ApproximatingStringTable
import org.jetbrains.kotlin.serialization.KotlinSerializerExtensionBase

Response:
import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerializerProtocol

class MetadataSerializerExtension(
    override val metadataVersion: BuiltInsBinaryVersion
) : KotlinSerializerExtensionBase(BuiltInSerializerProtocol) {
    override fun shouldUseTypeTable(): Boolean = true
    override val stringTable = ApproximatingStringTable()
}<|endoftext|>


Prompt:
"b", """
                    typealias X = Int
                    fun x(x: X) {}
                """.trimIndent()
            )
        }

        result.assertCommonized(
            "(a, b)", """
                typealias X = Int
                expect fun x(x: X)
            """.trimIndent()
        )
    }

Response:
fun `test inlined underscored typealias - both platforms`() {
        val result = commonize {
            outputTarget("(a, b)")
            simpleSingleSourceTarget(
                "a", """
                    typealias X = Int
                    typealias __X = X
                    fun x(x: __X) {}
                """.trimIndent()
            )

            simpleSingleSourceTarget(<|endoftext|>


Prompt:
protected fun createSingleTestRun(testCase: TestCase, executable: TestExecutable): TestRun = createTestRun(
        testCase = testCase,
        executable = executable,
        testRunName = /* Unimportant. Used only in dynamic tests. */ "",
        testName = null
    )

Response:
private fun getTestRunParameters(testCase: TestCase, testName: TestName?): List<TestRunParameter> = buildList {
        addIfNotNull(testCase.checks.outputDataFile?.file?.let(TestRunParameter::WithExpectedOutputData))

        when (testCase.kind) {
            TestKind.STANDALONE_LLDB -> {
                assertTrue(testName == null)<|endoftext|>


Prompt:
fun valuesNotNull(map: MutableMap<Int, String>) {
    map.<caret>compute(1) { k, v -> null }
}

fun valuesNullable(map: MutableMap<Int, String?>) {
    map.<caret>compute(1) { k, v -> v?.let { it + k } }
}

Response:
fun <T> valuesT(map: MutableMap<Int, T>, newValue: T) {
    map.<caret>compute(1) { k, v -> null }
}

fun <T : Any> valuesTNotNull(map: MutableMap<Int, T>, newValue: T) {
    map.<caret>compute(1) { k, v -> null }
}<|endoftext|>


Prompt:
returns("R")

        sample("samples.collections.Collections.Transformations.firstNotNullOf")

        doc {
            """
            Returns the first non-null value produced by [transform] function being applied to ${f.element.pluralize()} of this ${f.collection} in iteration order,
            or throws [NoSuchElementException] if no non-null value was produced.
            """

Response:
}
        body {
            """
            return firstNotNullOfOrNull(transform) ?: throw NoSuchElementException("No element of the ${f.collection} was transformed to a non-null value.")
            """
        }
    }

}<|endoftext|>


Prompt:
+if (dynamic) "$libGcc/crtbeginS.o" else "$libGcc/crtbegin.o"
            +"-L$libGcc"
            +"--hash-style=gnu"
            +specificLibs
            if (optimize) +linkerOptimizationFlags
            if (!debug) +linkerNoDebugFlags
            if (dynamic) +linkerDynamicFlags

Response:
+objectFiles
            +libraries
            +linkerArgs
            if (mimallocEnabled) +mimallocLinkerDependencies
            // See explanation about `-u__llvm_profile_runtime` here:<|endoftext|>


Prompt:
<!UNRESOLVED_REFERENCE!>B<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!>()

    <!UNRESOLVED_REFERENCE!>P<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!>()

Response:
<!UNRESOLVED_REFERENCE!>M<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!>()
}

class A() {
    companion object {
        class B() {
            companion object {
                fun foo() {}
            }
        }

        object P {
            fun foo() {}
        }
    }
}<|endoftext|>


Prompt:
fun getBeforeInlineDescriptor(afterInlineMarker: AbstractInsnNode): SavedStackDescriptor {
        val beforeInlineMarker = context.openingInlineMethodMarker[afterInlineMarker]
        return allocatedHandles[beforeInlineMarker]!!.savedStackDescriptor
    }

Response:
fun markAfterInlineMarkerEmitted(afterInlineMarker: AbstractInsnNode) {
        val beforeInlineMarker = context.openingInlineMethodMarker[afterInlineMarker]
        markEmitted(beforeInlineMarker!!)
    }

    private fun markEmitted(saveStackMarker: AbstractInsnNode) {
        val allocatedHandle = allocatedHandles[saveStackMarker]!!<|endoftext|>


Prompt:
// To simplify skipping this constructor when scanning call stack in Kotlin_getCurrentStackTrace.
            return true
        }
    }
    if (irFunction.symbol == context.ir.symbols.entryPoint) {
        return true
    }

    return false
}

private fun inferFunctionAttributes(contextUtils: ContextUtils, irFunction: IrFunction): List<LlvmFunctionAttribute> =

Response:
mutableListOf<LlvmFunctionAttribute>().apply {
            if (irFunction.returnType.isNothing()) {
                require(!irFunction.isSuspend) { "Suspend functions should be lowered out at this point"}
                add(LlvmFunctionAttribute.NoReturn)
            }
            if (mustNotInline(contextUtils.context, irFunction)) {<|endoftext|>


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

Response:
val CDATA_SECTION_NODE: Short
        val ENTITY_REFERENCE_NODE: Short
        val ENTITY_NODE: Short
        val PROCESSING_INSTRUCTION_NODE: Short
        val COMMENT_NODE: Short
        val DOCUMENT_NODE: Short
        val DOCUMENT_TYPE_NODE: Short<|endoftext|>


Prompt:
assertEquals(S("ef"), nonNull_nonNullMemExt.call(c, S("e")))
    assertEquals(S("ef"), nonNull_nonNullMemExt.getter.call(c, S("e")))

Response:
val nonNull_nullableMemExt = C::class.members.single { it.name == "nonNull_nullableMemExt" } as KMutableProperty2<C, S, S?>
    assertEquals(Unit, nonNull_nullableMemExt.setter.call(c, S(""), S("f")))<|endoftext|>


Prompt: <!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T: UserInterfaceA> testDifferencesInTypeParameterMultipleUpperBoundsPresenceB()<!> {}

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


Prompt:
) {
    val expectDeclaration = expectSymbol.owner as IrDeclaration
    val actualDeclaration = actualSymbol.owner as IrDeclaration
    at(expectDeclaration).report(
        IrActualizationErrors.EXPECT_ACTUAL_MISMATCH,
        expectDeclaration.getNameWithAssert().asString(),
        actualDeclaration.getNameWithAssert().asString(),

Response:
incompatibility
    )
}

internal fun IrDiagnosticReporter.reportActualAnnotationsNotMatchExpect(
    expectSymbol: IrSymbol,
    actualSymbol: IrSymbol,
    incompatibilityType: ExpectActualAnnotationsIncompatibilityType<IrConstructorCall>,
    reportOn: IrSymbol,
) {<|endoftext|>


Prompt: } else { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo2<!><!> }

Response:
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
    }
}

fun poll11(flag: Boolean): Flow<String> {
    return flow {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.analysis.api.signatures.KtCallableSignature
import org.jetbrains.kotlin.analysis.api.signatures.KtFunctionLikeSignature
import org.jetbrains.kotlin.analysis.api.signatures.KtVariableLikeSignature
import org.jetbrains.kotlin.psi.KtExpression

/**

Response:
* Call information at call site.
 */
public sealed class KtCallInfo : KtLifetimeOwner

/**
 * Successfully resolved call.
 */
public class KtSuccessCallInfo(private val _call: KtCall) : KtCallInfo() {
    override val token: KtLifetimeToken
        get() = _call.token<|endoftext|>


Prompt:
consumeInt(<!SUPER_CANT_BE_EXTENSION_RECEIVER!>super@KotlinSubclassOfJavaQualifiers<!>.missingField)
    }

    fun testPrivateField() {
        consumeString(super@KotlinSubclassOfJavaQualifiers.<!INVISIBLE_MEMBER!>privateField<!>)

Response:
consumeInt(<!TYPE_MISMATCH!>super@KotlinSubclassOfJavaQualifiers.<!INVISIBLE_MEMBER!>privateField<!><!>)
    }

    fun testPrivateFieldViaInnerClass() {
        val inner = Inner()
        inner.testPrivateField()
    }

    fun testMissingFieldViaInnerClass() {
        val inner = Inner()<|endoftext|>


Prompt:
package org.jetbrains.kotlin.noarg.diagnostic

import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.extensions.AnnotationBasedExtension
import org.jetbrains.kotlin.noarg.diagnostic.ErrorsNoArg.*

Response:
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtModifierListOwner
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker<|endoftext|>


Prompt:
val flagProperties = CompilerArgumentsContentProspector.getFlagCompilerArgumentProperties(K2MetadataCompilerArguments::class)
        val stringProperties = CompilerArgumentsContentProspector.getStringCompilerArgumentProperties(K2MetadataCompilerArguments::class)

Response:
val arrayProperties = CompilerArgumentsContentProspector.getArrayCompilerArgumentProperties(K2MetadataCompilerArguments::class)

        assertContentEquals(flagProperties, k2MetadataCompilerArgumentsFlagProperties)
        assertContentEquals(stringProperties, k2MetadataCompilerArgumentsStringProperties)<|endoftext|>


Prompt:
expect(null, { listOf<Int>().maxWithOrNull(naturalOrder()) })
        expect(1, { listOf(1).maxWithOrNull(naturalOrder()) })
        expect("B", { listOf("a", "B").maxWithOrNull(STRING_CASE_INSENSITIVE_ORDER) })

Response:
expect("B", { listOf("a", "B").asSequence().maxWithOrNull(STRING_CASE_INSENSITIVE_ORDER) })
    }

    @Test fun minByOrNull() {
        expect(null, { listOf<Int>().minByOrNull { it } })
        expect(1, { listOf(1).minByOrNull { it } })<|endoftext|>


Prompt:
import org.jetbrains.kotlin.gradle.util.buildProject
import org.jetbrains.kotlin.gradle.util.enableDefaultStdlibDependency
import org.jetbrains.kotlin.gradle.util.enableDependencyVerification
import org.junit.Test

class IdeOriginalMetadataDependencyResolverTest {

    @Test

Response:
fun `test kotlin-test-common`() {
        val lastLegacyMetadataKotlinTestVersion = "1.9.20"
        val project = buildProject {
            enableDependencyVerification(false)
            enableDefaultStdlibDependency(false)
            applyMultiplatformPlugin()
            repositories.mavenLocal()<|endoftext|>


Prompt:
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.light.classes.symbol.SymbolFakeFile
import org.jetbrains.kotlin.light.classes.symbol.analyzeForLightClasses
import org.jetbrains.kotlin.utils.addToStdlib.ifFalse
import javax.swing.Icon

Response:
abstract class SymbolLightClassBase protected constructor(val ktModule: KtModule, manager: PsiManager) :
    LightElement(manager, KotlinLanguage.INSTANCE), PsiClass, KtExtensibleLightClass {

    private val myInnersCache by lazyPub {
        ClassInnerStuffCache(
            /* aClass = */ this,
            /* generateEnumMethods = */ false,<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.resolve.ScopeSession

class FirExplicitSimpleImportingScope(
    imports: List<FirImport>,
    session: FirSession,
    scopeSession: ScopeSession
) : FirAbstractSimpleImportingScope(session, scopeSession) {
    override val simpleImports =
        imports.filterIsInstance<FirResolvedImport>()

Response:
.filter { !it.isAllUnder && it.importedName != null }
            .groupBy { it.aliasName ?: it.importedName!! }
}<|endoftext|>


Prompt:
IrBranchImpl(startOffset, irResult.endOffset, convertToIrExpression(condition), irResult)
            }
        }
    }

    override fun visitWhenSubjectExpression(whenSubjectExpression: FirWhenSubjectExpression, data: Any?): IrElement {
        val lastSubjectVariable = conversionScope.lastWhenSubject()

Response:
return whenSubjectExpression.convertWithOffsets { startOffset, endOffset ->
            IrGetValueImpl(startOffset, endOffset, lastSubjectVariable.type, lastSubjectVariable.symbol)
        }
    }

    private val loopMap = mutableMapOf<FirLoop, IrLoop>()<|endoftext|>


Prompt:
assertEquals("kotlin.jvm.functions.Function0<java.lang.Object>", getSuperInterface { null as Nothing? })
    assertEquals("interface kotlin.jvm.functions.Function0", getSuperInterfaceGeneric { null })

    // Test WithExpectedType resolution mode

Response:
assertEquals("kotlin.jvm.functions.Function0<kotlin.Unit>", renderSuperInterface(lambdaEmpty))
    assertEquals("kotlin.jvm.functions.Function0<kotlin.Unit>", renderSuperInterface(lambdaUnit))
    assertEquals("kotlin.jvm.functions.Function0<kotlin.Unit>", renderSuperInterface(lambdaMyUnit))<|endoftext|>


Prompt:
fqName?.let(visitor::visitFqName)
    }
}

internal class KlibModuleFragmentExtension : KlibModuleFragmentExtensionVisitor(), KmModuleFragmentExtension {

    val moduleFragmentFiles: MutableList<KlibSourceFile> = ArrayList()
    var fqName: String? = null

Response:
val className: MutableList<ClassName> = ArrayList()

    override fun visitFile(file: KlibSourceFile) {
        moduleFragmentFiles += file
    }

    override fun visitFqName(fqName: String) {
        this.fqName = fqName
    }

    override fun visitClassName(className: ClassName) {<|endoftext|>


Prompt:
<!WRONG_MODIFIER_TARGET!>abstract<!> var c3: Int = 0; set(v: Int) { field = v }

    val e: Int                               get() = a
    val e1: Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>0<!>;          get() = a

Response:
<!WRONG_MODIFIER_TARGET!>abstract<!> val e2: Int      get() = a
    <!WRONG_MODIFIER_TARGET!>abstract<!> val e3: Int = 0; get() = a

    //methods
    <!NON_MEMBER_FUNCTION_NO_BODY!>fun f()<!>
    fun g() {}<|endoftext|>


Prompt:
}
        }

        if (method.isSuspend && method.overriddenDescriptors.isEmpty()) {
            return implicitSuspendThrows
        }

        return null
    }

    private val implicitSuspendThrows = sequenceOf(ClassId.topLevel(KonanFqNames.cancellationException))

    private fun mapReturnType(

Response:
returnBridge: MethodBridge.ReturnValue,
        method: FunctionDescriptor,
        objCExportScope: ObjCExportScope,
    ): ObjCType = when (returnBridge) {
        MethodBridge.ReturnValue.Suspend,
        MethodBridge.ReturnValue.Void,
        -> ObjCVoidType
        MethodBridge.ReturnValue.HashCode -> ObjCPrimitiveType.NSUInteger<|endoftext|>


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

// T is the immutable type
interface Builder<out T> {
    fun build(): T
}

// T is the immutable type, U is the builder
interface Copyable<out T, out U : Builder<T>> {
    fun builder(): U
}

Response:
fun <T : Copyable<T, U>, U : Builder<T>> T.copy(fn: U.() -> Unit): T = throw Exception()

open class Foo(val x: Int, val y: Int) : Copyable<Foo, Foo.FooBuilder> {
    override fun builder(): FooBuilder = FooBuilder(x, y)<|endoftext|>


Prompt:
import org.jetbrains.kotlin.diagnostics.PositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT
import org.jetbrains.kotlin.diagnostics.Severity
import org.jetbrains.kotlin.psi.KtCallableReferenceExpression
import org.jetbrains.kotlin.psi.KtExpression

Response:
import org.jetbrains.kotlin.types.KotlinType

object ComposeErrors {

    // error goes on the composable call in a non-composable function
    @JvmField
    val COMPOSABLE_INVOCATION =
        DiagnosticFactory0.create<PsiElement>(
            Severity.ERROR
        )<|endoftext|>


Prompt:
// Just a sanity check to avoid creating invalid [InvalidInheritance]s.
                check(superClassSymbols.isNotEmpty())
            }
        }

        /**
         * The annotation class has unacceptable classifier as one of its parameters: not one of permitted classes ([String], [KClass]),
         * primitives, etc. This may happen if the class representing this parameter was an annotation class before, but later it was

Response:
* converted to a non-annotation class.
         */
        data class AnnotationWithUnacceptableParameter(
            override val symbol: IrClassSymbol,
            val unacceptableClassifierSymbol: IrClassifierSymbol
        ) : CanBeRootCause

        /**
         * The classifier depends on another unusable classifier. Thus, it is considered unusable too.
         */<|endoftext|>


Prompt:
import org.jetbrains.kotlin.parcelize.ParcelizeNames.PARCELABLE_FQN
import org.jetbrains.kotlin.parcelize.ParcelizeNames.PARCELER_FQN
import org.jetbrains.kotlin.parcelize.ParcelizeNames.WRITE_TO_PARCEL_NAME

Response:
import org.jetbrains.kotlin.parcelize.serializers.ParcelizeExtensionBase
import org.jetbrains.kotlin.types.Variance

// true if the class should be processed by the parcelize plugin
fun IrClass.isParcelize(parcelizeAnnotations: List<FqName>): Boolean =<|endoftext|>


Prompt:
import org.jetbrains.kotlin.resolve.BindingTrace

object PublishedApiUsageChecker {
    fun check(
        declaration: KtDeclaration,
        descriptor: DeclarationDescriptor,
        trace: BindingTrace
    ) {
        if (descriptor !is DeclarationDescriptorWithVisibility || descriptor.visibility == DescriptorVisibilities.INTERNAL) return

Response:
// Don't report the diagnostic twice
        if (descriptor is PropertyAccessorDescriptor) return

        for (entry in declaration.annotationEntries) {
            val annotationDescriptor = trace.get(BindingContext.ANNOTATION, entry) ?: continue
            if (annotationDescriptor.fqName == StandardNames.FqNames.publishedApi) {<|endoftext|>


Prompt:
}
    })
}

inline fun <reified T : PsiElement> PsiElement.anyDescendantOfType(noinline predicate: (T) -> Boolean = { true }): Boolean {
    return findDescendantOfType(predicate) != null
}

inline fun <reified T : PsiElement> PsiElement.anyDescendantOfType(

Response:
crossinline canGoInside: (PsiElement) -> Boolean,
    noinline predicate: (T) -> Boolean = { true }
): Boolean {
    return findDescendantOfType(canGoInside, predicate) != null
}

inline fun <reified T : PsiElement> PsiElement.findDescendantOfType(noinline predicate: (T) -> Boolean = { true }): T? {<|endoftext|>


Prompt:
constructor() : this("s")
}
class SecondaryWithDefaults(val s: String) {
    constructor(x: Int = 0) : this(x.toString())
}
class SecondaryWithDefaultsNoPrimary {
    constructor(x: Int) {}
    constructor(s: String = "") {}
}

// Bad classes

class NoNoArgConstructor(val s: String) {

Response:
constructor(x: Int) : this(x.toString())
}
class NoArgAndDefault() {
    constructor(x: Int = 0) : this()
}
class DefaultPrimaryAndDefaultSecondary(val s: String = "") {
    constructor(x: Int = 0) : this(x.toString())
}
class SeveralDefaultSecondaries {
    constructor(x: Int = 0) {}<|endoftext|>


Prompt:
.appendText("\ndependencies { \"jvmAndJsMainCompileOnly\"(kotlin(\"test\")) }")
            projectPath.resolve("my-lib-foo/src/jvmAndJsMain/kotlin/UseCompileOnlyDependency.kt").writeText(
                """
            import kotlin.test.Test

            class UseCompileOnlyDependency {

Response:
@Test
                fun myTest() = Unit
            }
            """.trimIndent()
            )

            build(":my-lib-foo:compileJvmAndJsMainKotlinMetadata")
        }

    @GradleTestVersions(minVersion = TestVersions.Gradle.G_7_0)
    @GradleTest
    @DisplayName("HMPP dependencies in js tests")<|endoftext|>


Prompt:
// NB: We can't expand typealiases (`toAnnotationClassId`), because it
    // requires `lookupTag.tySymbol()`, but we can have cycles in annotations.
    // See the commit message for an example.

    val annotations = session.annotationPlatformSupport.deprecationAnnotationsWithOverridesPropagation
        .flatMap { (classId, shouldPropagateToOverrides) ->

Response:
this.filter {
                it.unexpandedClassId == classId
            }.map {
                it to shouldPropagateToOverrides
            }
        }

    return buildDeprecationAnnotationInfoPerUseSiteStorage {
        for ((deprecated, shouldPropagateToOverrides) in annotations) {<|endoftext|>


Prompt:
package org.jetbrains.kotlin.ir.backend.js.lower.calls

import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression

Response:
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.types.*<|endoftext|>


Prompt:
class Foo {
    val x = 1

    fun abc() = x

    fun cba() = abc()
}

class Bar {
    val x = ""

    // NB: unused
    fun Foo.abc() = x

    fun bar(): Bar = this

    // NB: unused
    operator fun String.plus(bar: Bar): String {
        return ""
    }

Response:
// NB! abc() here is resolved to member Foo.abc(), and not to extension member of Bar
    fun Foo.check() = abc() <!NONE_APPLICABLE!>+<!> bar()

    // NB! + here is resolved to member String.plus (not to extension member above)
    fun Foo.check2() = "" + bar()
}

fun Foo.ext() = x<|endoftext|>


Prompt:
descriptor.runtimeElementsPublished.configure?.invoke(decorated, runtimeElementsPublishedConfiguration)
    descriptor.sourcesElementsPublished.configure?.invoke(decorated, sourcesElementsPublishedConfiguration)
    descriptor.configureIdeImport?.invoke(project.kotlinIdeMultiplatformImport)

    targets.add(decorated)

Response:
decorated.logger.info("Created ${descriptor.platformType} target")
    return decorated
}

/**
 * @see createExternalKotlinTarget
 */
@ExternalKotlinTargetApi
fun <T : DecoratedExternalKotlinTarget> KotlinMultiplatformExtension.createExternalKotlinTarget(<|endoftext|>


Prompt:
diagnosticHandler = { if (it.isError()) errors.add(it) }
    )
    try {
        if (errors.isNotEmpty()) {
            val errorMessage = errors.take(10).joinToString("\n") { it.format }
            throw Error(errorMessage)
        }

        translationUnit.ensureNoCompileErrors()

Response:
indexTranslationUnit(index, translationUnit, 0, object : Indexer {
            override fun importedASTFile(info: CXIdxImportedASTFileInfo) {
                result += info.file!!.canonicalPath
            }
        })
    } finally {
        clang_disposeTranslationUnit(translationUnit)
    }
    return result.toList()
}

private fun getModulesHeaders(<|endoftext|>


Prompt:
// !LANGUAGE: -ProhibitProtectedCallFromInline
// TARGET_BACKEND: JVM
// The non-IR backend attempts to call a non-existent accessor in class Test.
// IGNORE_BACKEND: JVM

// FILE: Test.java

public class Test {
    protected static String testStatic() {
        return "OK";
    }
}

// FILE: test.kt

Response:
class Test2 {
    inline fun test() = Test.testStatic()
}

// FILE: test2.kt

package anotherPackage

import Test2

fun box() = Test2().test()<|endoftext|>


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

var setterInvoked = 0
var backing = 42

OPTIONAL_JVM_INLINE_ANNOTATION
value class Delegate<T: Int>(val ignored: T) {

    operator fun getValue(thisRef: Any?, prop: Any?) =

Response:
backing

    operator fun setValue(thisRef: Any?, prop: Any?, newValue: Int) {
        setterInvoked++
        backing = newValue
    }
}

var topLevelD by Delegate(0)

fun box(): String {
    if (topLevelD != 42) AssertionError()

    topLevelD = 1234<|endoftext|>


Prompt:
private fun wrapEsModule(function: JsFunction): List<JsStatement> {
        val (alreadyPresentedImportStatements, restStatements) = function.body.statements
            .flatMap { if (it is JsCompositeBlock) it.statements else listOf(it) }
            .partitionIsInstance<JsStatement, JsImport>()

Response:
val (multipleElementsImport, defaultImports) = alreadyPresentedImportStatements.partition { it.target is JsImport.Target.Elements }

        val mergedImports = multipleElementsImport
            .groupBy { it.module }
            .map { (module, import) -><|endoftext|>