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

/**
 * Cartesian product of two and more collections.
 * Returns a sequence of all possible combinations between given elements.
 * Combination is represented as a list with indexes matching order of inputs
 * i.e.
 * ```

Response:
* cartesianProductOf(listOf("a", "b"), listOf(1, 2), listOf(4.3, 6.3)).map { list ->
 *    list[0] // will contain elements of the first argument e.g. "a"
 *    list[1] // will contain elements of the second argument e.g. 2<|endoftext|>


Prompt:
import kotlin.reflect.KProperty

fun foo(f: () -> Unit) {
    f()
}

class Wrapper(var s: String)

fun bar(w: Wrapper?) {
    // K1: type is () -> Unit, K2: type is () -> Unit?
    val lambda = {
        w?.s = "X"
    }

Response:
// K1: Ok, K2: ARGUMENT_TYPE_MISMATCH
    foo(lambda)
}

class Wrapper2(val w: Wrapper?)

fun baz(w2: Wrapper2?) {
    val lambda = {
        w2?.w?.s = "X"
    }
    foo(lambda)
}

object Indexible {<|endoftext|>


Prompt:
result.addIfNotNull(this.setter?.translateToObjCMethod())
            }
        }
        is KtFunctionSymbol -> result.addIfNotNull(translateToObjCMethod())
        else -> Unit
    }
    return result
}

context(KtAnalysisSession, KtObjCExportSession)

Response:
internal fun KtClassOrObjectSymbol.translateToObjCExportStub(): ObjCClass? = when (classKind) {
    KtClassKind.INTERFACE -> translateToObjCProtocol()
    KtClassKind.CLASS -> translateToObjCClass()
    KtClassKind.OBJECT -> translateToObjCObject()
    KtClassKind.ENUM_CLASS -> translateToObjCClass()<|endoftext|>


Prompt:
return if (mangler.run { descriptor.isExported(compatibleMode = false) })
            createSignatureBuilder(SpecialDeclarationType.ENUM_ENTRY).buildSignature(descriptor)
        else null
    }

    override fun composeFieldSignature(descriptor: PropertyDescriptor): IdSignature? {

Response:
return if (mangler.run { descriptor.isExported(compatibleMode = false) }) {
            createSignatureBuilder(SpecialDeclarationType.BACKING_FIELD).buildSignature(descriptor)
        } else null
    }

    override fun composeAnonInitSignature(descriptor: ClassDescriptor): IdSignature? {<|endoftext|>


Prompt:
inline fun <reified T> f(x: T) =
    T::class.simpleName

fun call(c: Consumer<OK>) = c.accept(OK())

fun box(): String {
    return call(::f) // `f` has a reified type parameter and thus isn't callable directly
}

// FILE: Consumer.java

public interface Consumer<T> {
    String accept(T t);

Response: }<|endoftext|>


Prompt:
*     interface java.util.Collection<T> {
 *         fun contains(element: java.lang.Object): Boolean
 *         ...
 *     }
 *
 * in Java. In particular, the Java version is not type-safe: it requires us to implement the method
 * given arbitrary objects, even though we know based on the types that our collection can only contain

Response:
* members of type `T`. This is why we have to introduce type-safe wrappers into Kotlin collection classes.
 * In the example above, we produce:
 *
 *    abstract class A : java.util.Collection, I {
 *        ...
 *        fun contains(element: java.lang.Object): Boolean {
 *            if (element !is Int) return false
 *            return contains(element as Int)
 *        }<|endoftext|>


Prompt:
val PropertySymbolMarker.isVar: Boolean
    val PropertySymbolMarker.isLateinit: Boolean
    val PropertySymbolMarker.isConst: Boolean

    val PropertySymbolMarker.getter: FunctionSymbolMarker?
    val PropertySymbolMarker.setter: FunctionSymbolMarker?

    fun createExpectActualTypeParameterSubstitutor(

Response:
expectTypeParameters: List<TypeParameterSymbolMarker>,
        actualTypeParameters: List<TypeParameterSymbolMarker>,
        parentSubstitutor: TypeSubstitutorMarker?
    ): TypeSubstitutorMarker

    fun RegularClassSymbolMarker.collectAllMembers(isActualDeclaration: Boolean): List<DeclarationSymbolMarker><|endoftext|>


Prompt:
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.vfs.VirtualFileWithId
import com.intellij.reference.SoftReference
import org.jetbrains.kotlin.load.kotlin.KotlinBinaryClassCache
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass

Response:
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName

class ClsKotlinBinaryClassCache {<|endoftext|>


Prompt:
package org.kotlin

fun plus(a: Int, b: Int, c: Int) =
    a + b + c

fun logicalOr(a: Boolean, b: Boolean) = a || b

fun xor(a: Boolean, b: Boolean) = a xor b

fun plus(a: UByte, b: UByte) = a + b

Response:
fun minus(a: UByte, b: UByte) = a - b

fun plus(a: UShort, b: UShort) = a + b
fun minus(a: UShort, b: UShort) = a - b

fun plus(a: UInt, b: UInt) = a + b
fun minus(a: UInt, b: UInt) = a - b<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
import org.jetbrains.kotlin.fir.symbols.impl.*
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
import org.jetbrains.kotlin.utils.addToStdlib.flatAssociateBy

Response:
object FirUninitializedEnumChecker : FirQualifiedAccessExpressionChecker(MppCheckerKind.Common) {
    // Initialization order: member property initializers, enum entries, companion object (including members in it).
    //
    // When JVM loads a class, the corresponding class initializer, a.k.a. <clinit>, is executed first.<|endoftext|>


Prompt:
builtIns: KotlinBuiltIns,
    callback: (DataFlowValue, D) -> Unit
) {
    for ((key, setOfValues) in dictionary) {
        val leftDfv = key.toDataFlowValue(builtIns) ?: continue
        setOfValues.forEach { callback(leftDfv, it) }
    }
}

Response:
private fun ESValue.toDataFlowValue(builtIns: KotlinBuiltIns): DataFlowValue? = when (this) {
    is ESDataFlowValue -> dataFlowValue
    is ESConstant -> when (constantReference) {
        ConstantReference.NULL -> DataFlowValue.nullValue(builtIns)
        else -> DataFlowValue(IdentifierInfo.NO, type.toKotlinType(builtIns))
    }<|endoftext|>


Prompt:
if (element17 in emptyCollection.indices != range1.contains(element17)) throw AssertionError()
    if (element17 !in emptyCollection.indices != !range1.contains(element17)) throw AssertionError()
    if (!(element17 in emptyCollection.indices) != !range1.contains(element17)) throw AssertionError()

Response:
if (!(element17 !in emptyCollection.indices) != range1.contains(element17)) throw AssertionError()
}

fun testR1xE18() {
    // with possible local optimizations
    if (3 in emptyCollection.indices != range1.contains(3)) throw AssertionError()<|endoftext|>


Prompt: // _Arrays.kt:... box: $i$f$foo\56\65:int=0:int, array\56:java.lang.Integer[]=java.lang.Integer[], myClass\56:MyClass=MyClass, $this$map\87:java.lang.Object[]=java.lang.Integer[], $i$f$map\87\552:int=0:int,

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


Prompt:
copyRemappedTypeArgumentsFrom(expression)
                transformValueArguments(expression)
            }
        }

        return super.visitCall(expression)
    }

    private fun IrSimpleFunctionSymbol.isBoundButNotRemapped(): Boolean {
        return this.isBound && symbolRemapper.getReferencedFunction(this) == this
    }

Response:
private fun IrSimpleFunctionSymbol.isRemappedAndBound(): Boolean {
        val symbol = symbolRemapper.getReferencedFunction(this)
        return symbol.isBound && symbol != this
    }

    /* copied verbatim from DeepCopyIrTreeWithSymbols, except with newCallee as a parameter */<|endoftext|>


Prompt:
val LINK_VIA_SIGNATURES_K1 by directive("Use linkage via signatures instead of descriptors on the K1 frontend")
    val ENABLE_JVM_IR_INLINER by directive("Enable inlining on IR, instead of inlining on bytecode")
    val USE_INLINE_SCOPES_NUMBERS by directive("Use inline scopes numbers for inline marker variables")

Response:
val GENERATE_PROPERTY_ANNOTATIONS_METHODS by directive(
        description = "Enables corresponding analysis flag (JvmAnalysisFlags.generatePropertyAnnotationsMethods)"
    )
    val DONT_WARN_ON_ERROR_SUPPRESSION by directive("Don't emit warning when an error is suppressed")

    // --------------------- Utils ---------------------<|endoftext|>


Prompt:
E1.A -> {}
        E2.A -> {}
        else -> {}
    }

    when (e) {
        e -> {}
        e2 -> {}
        E1.A -> {}
        E2.A -> {}
        else -> {}
    }
}

interface MyInterface
open class MyOpenClass

Response:
fun foo4(e1: E1, i: MyInterface, c: MyOpenClass) {
    <!INCOMPATIBLE_ENUM_COMPARISON!>e1 == i<!>
    <!INCOMPATIBLE_ENUM_COMPARISON!>i == e1<!>

    <!INCOMPATIBLE_ENUM_COMPARISON!>e1 == c<!><|endoftext|>


Prompt:
assertEquals(true, notNullToNotNull(B()), "B is B")
    assertEquals(false, notNullToNotNull(C()), "C is B")
    assertEquals(true, notNullToNotNull(D()), "D is B")
    assertEquals(true, notNullToNotNull(E()), "E is B")

Response:
assertEquals(false, notNullToNotNull(F()), "F is B")
    assertEquals(false, notNullToNotNull(Any()), "Any is B")
    assertEquals(false, dtoB(dyn), "dynamic is B")

    assertEquals(false, notNullToNotNull({}), "Function is II")<|endoftext|>


Prompt:
* * It can only add to the end of the [descriptors] list and shall not modify it otherwise (e.g. remove from it).
     * * Before the call, [descriptors] should already contain all declared properties with the [name] name.
     */
    protected open fun computeNonDeclaredProperties(name: Name, descriptors: MutableList<PropertyDescriptor>) {
    }

Response:
private fun getTypeAliasByName(name: Name): TypeAliasDescriptor? {
        return impl.getTypeAliasByName(name)
    }

    override fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
        return impl.getContributedVariables(name, location)
    }

    protected fun computeDescriptors(<|endoftext|>


Prompt:
val ret = build {
        emit("1")
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Comparable<*>? & java.io.Serializable?")!>select1(get(), getIn())<!>
        select1(get(), Test.foo(getIn()))
        select1(Test.foo(get()), Test.foo(getIn()))

Response:
select1(Test.foo(get()), getIn())
        select4(get(), getIn())
        select4(get(), Test.foo(getIn()))
        select4(Test.foo(get()), Test.foo(getIn()))
        select4(Test.foo(get()), getIn())

        select4(id(Test.foo(get())), getIn())

        build2 {<|endoftext|>


Prompt:
if (property.hasGetterFlags() && Flags.IS_INLINE_ACCESSOR.get(property.getterFlags)
            && (!excludePrivateAccessors || !isPrivate(property.getterFlags))
        ) {
            val getter = propertySignature.getter
            inlineAccessors.add(
                InlinePropertyAccessor(

Response:
JvmMemberSignature.Method(name = nameResolver.getString(getter.name), desc = nameResolver.getString(getter.desc)),
                    propertyName = nameResolver.getString(property.name)
                )
            )
        }
        if (property.hasSetterFlags() && Flags.IS_INLINE_ACCESSOR.get(property.setterFlags)<|endoftext|>


Prompt:
array: CharArray, left: Int, right: Int): Int {
    var i = left
    var j = right
    val pivot = array[(left + right) / 2]
    while (i <= j) {
        while (array[i] < pivot)
            i++
        while (array[j] > pivot)
            j--
        if (i <= j) {

Response:
val tmp = array[i]
            array[i] = array[j]
            array[j] = tmp
            i++
            j--
        }
    }
    return i
}

private fun quickSort(
        array: CharArray, left: Int, right: Int) {
    val index = partition(array, left, right)
    if (left < index - 1)<|endoftext|>


Prompt:
LanguageVersionSettingsImpl(LanguageVersion.LATEST_STABLE, ApiVersion.LATEST)

    override fun build(): KtScriptModule {
        return KtScriptModuleImpl(
            directRegularDependencies,
            directDependsOnDependencies,
            directFriendDependencies,
            platform,
            kotlinCoreProjectEnvironment.project,
            file,
            languageVersionSettings
        )

Response:
}
}

@OptIn(ExperimentalContracts::class)
public inline fun KtModuleProviderBuilder.buildKtScriptModule(init: KtScriptModuleBuilder.() -> Unit): KtScriptModule {
    contract {
        callsInPlace(init, InvocationKind.EXACTLY_ONCE)
    }
    return KtScriptModuleBuilder(kotlinCoreProjectEnvironment).apply(init).build()<|endoftext|>


Prompt:
@NullMarked
public class NullMarkedTypeWithNullUnmarkedConstructor {
    @NullUnmarked
    public NullMarkedTypeWithNullUnmarkedConstructor(String arg) {}
}

// FILE: kotlin.kt

interface TestA: NullMarkedType.NullUnmarkedType {
    override fun unannotatedProduce(): String?
}

Response:
interface TestB: NullMarkedType.UnannotatedType {
    override fun nullUnmarkedProduce(): String?
}

fun test(
    a: NullMarkedType.NullUnmarkedType,
    b: NullMarkedType.UnannotatedType
) {
    a.unannotatedConsume(null)
    b.nullUnmarkedConsume(null)<|endoftext|>


Prompt: expectFailure(linkage("Function 'getInterfaceToFinalClassNestedImpl2Inline' can not be called: Function uses class 'InterfaceToFinalClassImpl' (via class 'InterfaceToFinalClassImpl2') that inherits from final class 'InterfaceToFinalClass'")) { getInterfaceToFinalClassNestedImpl2Inline() }

Response: expectFailure(linkage("Constructor 'InterfaceToFinalClassImpl2.<init>' can not be called: Class 'InterfaceToFinalClassImpl2' uses class 'InterfaceToFinalClassImpl' that inherits from final class 'InterfaceToFinalClass'")) { getInterfaceToFinalClassNestedImpl2AsAny() }<|endoftext|>


Prompt:
parameter<Int>("expectedCount")
            parameter<FirClassLikeSymbol<*>>("classifier")
        }
        val OUTER_CLASS_ARGUMENTS_REQUIRED by error<PsiElement> {
            parameter<FirClassLikeSymbol<*>>("outer")
        }

Response:
val TYPE_PARAMETERS_IN_OBJECT by error<PsiElement>(PositioningStrategy.TYPE_PARAMETERS_LIST)
        val TYPE_PARAMETERS_IN_ANONYMOUS_OBJECT by error<PsiElement>(PositioningStrategy.TYPE_PARAMETERS_LIST)
        val ILLEGAL_PROJECTION_USAGE by error<PsiElement>()<|endoftext|>


Prompt:
checkNPE { notNull2StructRef(structRef) }
    check (nullStructRef(structRef) == structRef)
    check (null2StructRef(structRef) == null)
}

fun notNullInt(): Int = js("123")

fun notNull2Int(): Int = js("null")

fun nullInt(): Int? = js("123")

Response:
fun null2Int(): Int? = js("null")

fun testInt() {
    check(notNullInt() == 123)
    check(notNull2Int() == 0)
    check(nullInt() == 123)
    check(null2Int() == null)
}

fun notNullBoolean(): Boolean = js("true")

fun notNull2Boolean(): Boolean = js("null")<|endoftext|>


Prompt:
processedArgs.add(argName)
        }
    }
    return ObjCName(name!!, objCName, swiftName, isExact)
}

internal val ModuleDescriptor.objCExportAdditionalNamePrefix: String
    get() {
        if (this.isNativeStdlib()) return "Kotlin"

Response:
val fullPrefix = when (val module = this.klibModuleOrigin) {
            CurrentKlibModuleOrigin ->
                error("expected deserialized module, got $this (origin = $module)")
            SyntheticModulesOrigin ->
                this.name.asString().let { it.substring(1, it.lastIndex) }
            is DeserializedKlibModuleOrigin -><|endoftext|>


Prompt:
+field("constructorTypeArgumentsCount", int)
    }
    val getSingletonValue: Element by element(Expression) {
        nameInVisitorMethod = "SingletonReference"

        parent(declarationReference)
    }
    val getObjectValue: Element by element(Expression) {

        parent(getSingletonValue)

        +symbol(classSymbolType, mutable = true)

Response:
}
    val getEnumValue: Element by element(Expression) {

        parent(getSingletonValue)

        +symbol(enumEntrySymbolType, mutable = true)
    }

    val rawFunctionReference: Element by element(Expression) {
        parent(declarationReference)

        kDoc = """
        Represents a platform-specific low-level reference to a function.<|endoftext|>


Prompt:
}
            else -> {
                args[i++]
            }
        }

        if (!getter.returnType.isArray && !visitedArgs.add(argument.value) && value is String && getter(result) != value
        ) {
            errors.value.duplicateArguments[argument.value] = value
        }

Response:
updateField(getter, setter, result, value, argument.resolvedDelimiter, overrideArguments)
    }

    result.freeArgs += freeArgs
    result.updateInternalArguments(internalArguments, overrideArguments)
}

private fun <A : CommonToolArguments> A.updateInternalArguments(
    newInternalArguments: ArrayList<InternalArgument>,
    overrideArguments: Boolean<|endoftext|>


Prompt:
fun clang_parseTranslationUnit(CIdx: CXIndex?, source_filename: String?, command_line_args: CValuesRef<CPointerVar<ByteVar>>?, num_command_line_args: Int, unsaved_files: CValuesRef<CXUnsavedFile>?, num_unsaved_files: Int, options: Int): CXTranslationUnit? {
    memScoped {

Response:
return interpretCPointer<CXTranslationUnitImpl>(kniBridge75(CIdx.rawValue, source_filename?.cstr?.getPointer(memScope).rawValue, command_line_args?.getPointer(memScope).rawValue, num_command_line_args, unsaved_files?.getPointer(memScope).rawValue, num_unsaved_files, options))
    }
}<|endoftext|>


Prompt:
ThrowableArguments(message = undefinedValue(), cause = arg)
                    }
                }
            }
        }

    inner class Transformer : IrElementTransformer<IrDeclarationParent> {
        private val anyConstructor = context.irBuiltIns.anyClass.constructors.first()

Response:
override fun visitClass(declaration: IrClass, data: IrDeclarationParent) = super.visitClass(declaration, declaration)

        override fun visitConstructorCall(expression: IrConstructorCall, data: IrDeclarationParent): IrExpression {
            expression.transformChildren(this, data)
            if (expression.symbol !in throwableConstructors) return expression<|endoftext|>


Prompt:
sendTeamCityRequest("$teamCityBuildUrl/startDate"),
                getBuildType())).then { results ->
            val (buildNumber, branch, startTime, buildType) = results
            val currentTime = Date()
            val timeZone = currentTime.getTimezoneOffset() / -60    // Convert to hours.
            // Get finish time as current time, because buid on TeamCity isn't finished.

Response:
val finishTime = "${format(currentTime.getUTCFullYear())}" +
                    "${format(currentTime.getUTCMonth() + 1)}" +
                    "${format(currentTime.getUTCDate())}" +
                    "T${format(currentTime.getUTCHours())}" +
                    "${format(currentTime.getUTCMinutes())}" +<|endoftext|>


Prompt:
kotlinSourcesDir(sourceSet).resolve("ActualFunFoo.kt").addPrivateVal()
            }

            build("assemble", buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)) {
                assertTasksExecuted(":compileKotlinJvm", ":compileKotlinJs", ":compileKotlinNative")
                assertIncrementalCompilation(

Response:
listOf(
                        kotlinSourcesDir("jvmMain").resolve("ActualFunFoo.kt"),
                        kotlinSourcesDir("jsMain").resolve("ActualFunFoo.kt"),
                        kotlinSourcesDir("commonMain").resolve("ExpectFunFoo.kt")
                    ).relativizeTo(projectPath)
                )
            }
        }
    }<|endoftext|>


Prompt: // library.kt:14 box: xFoo\1:int=1:int, $i$f$foo\1\34:int=0:int, it\19:int=2:int, $i$a$-foo-TestKt$box$2\19\177\0:int=0:int, y2\19:int=2:int, xBar1\20:int=1:int,

Response: xBar2\20:int=2:int, xBar3\20:int=3:int, $i$f$bar\20\39:int=0:int<|endoftext|>


Prompt:
myClass as KtClassOrObject, bindingContext, descriptor, classAsmType, context, v, state
        ).generate()
    }

    private fun generateUnboxMethod() {
        val boxMethodDescriptor = InlineClassDescriptorResolver.createBoxFunctionDescriptor(descriptor)

        functionCodegen.generateMethod(

Response:
Synthetic(null, boxMethodDescriptor), boxMethodDescriptor, object : FunctionGenerationStrategy.CodegenBased(state) {
                override fun mapMethodSignature(
                    functionDescriptor: FunctionDescriptor,
                    typeMapper: KotlinTypeMapper,
                    contextKind: OwnerKind,
                    hasSpecialBridge: Boolean
                ): JvmMethodGenericSignature {<|endoftext|>


Prompt:
""",
        source = """
            import androidx.compose.runtime.*

            @Composable fun Icon(
                param: Int,
                defaultParam: Int = LocalColor.current
            ) {
                val remembered = remember(param, defaultParam) { TODO() }
            }
        """
    )

    @Test
    fun testRememberMethodReference() = verifyGoldenComposeIrTransform(

Response:
source = """
            import androidx.compose.runtime.*

            @Composable fun Icon(
                param: Int
            ) {
                val remembered = remember(param::toString) { TODO() }
            }
        """
    )
}<|endoftext|>


Prompt:
abstract class AbstractSamWithReceiverTest : AbstractDiagnosticTest() {
    override fun configure(builder: TestConfigurationBuilder) {
        super.configure(builder)
        with(builder) {
            configurePlugin()
        }
    }
}

abstract class AbstractFirPsiSamWithReceiverDiagnosticTest : AbstractFirPsiDiagnosticTest() {

Response:
override fun configure(builder: TestConfigurationBuilder) {
        super.configure(builder)
        with(builder) {
            configurePlugin()
            configurationForClassicAndFirTestsAlongside()
        }
    }
}

// ------------------------ codegen ------------------------

open class AbstractIrBlackBoxCodegenTestForSamWithReceiver : AbstractIrBlackBoxCodegenTest() {<|endoftext|>


Prompt:
return CharProgression.fromClosedRange(last, first, -step)
}

/**
 * Returns a progression that goes over the same range with the given step.
 *
 * @sample samples.ranges.Ranges.stepInt
 */
public infix fun IntProgression.step(step: Int): IntProgression {
    checkStepIsPositive(step > 0, step)

Response:
return IntProgression.fromClosedRange(first, last, if (this.step > 0) step else -step)
}

/**
 * Returns a progression that goes over the same range with the given step.
 *
 * @sample samples.ranges.Ranges.stepLong
 */
public infix fun LongProgression.step(step: Long): LongProgression {<|endoftext|>


Prompt:
fun BuildResult.getErrorMessages(): String =
                regex.findAll(output).map { it.value }.joinToString("\n")

            fun genJavaErrorString(vararg lines: Int) =
                lines.joinToString("\n") { "Test.java:$it: error: GenError element" }

            fun genKotlinErrorString(vararg lines: Int) =

Response:
lines.joinToString("\n") { "test.kt:$it: error: GenError element" }

            buildAndFail("build") {
                val actual = getErrorMessages()
                assertEquals(
                    expected = genJavaErrorString(
                        7,<|endoftext|>


Prompt:
protected fun getStaticVolatileWrapperInstance(volatileWrapperClass: IrClass): IrExpression {
        val volatileWrapperClassInstance = volatileWrapperClass.parentDeclarationContainer.declarations.find {
            it is IrProperty && it.backingField?.type?.classOrNull == volatileWrapperClass.symbol

Response:
} ?: error("Instance of ${volatileWrapperClass.name.asString()} was not found in the parent class ${volatileWrapperClass.parentDeclarationContainer.render()}")
        return with(atomicSymbols.createBuilder(volatileWrapperClass.symbol)) {
            irGetProperty(volatileWrapperClassInstance as IrProperty, null)
        }
    }<|endoftext|>


Prompt:
fun KtFunction.getCalleeByLambdaArgument(): KtSimpleNameExpression? {
    val argument = getParentOfTypeAndBranch<KtValueArgument> { getArgumentExpression() } ?: return null
    val callExpression = when (argument) {
        is KtLambdaArgument -> argument.parent as? KtCallExpression

Response:
else -> (argument.parent as? KtValueArgumentList)?.parent as? KtCallExpression
    } ?: return null
    return callExpression.calleeExpression as? KtSimpleNameExpression
}<|endoftext|>


Prompt:
buildAndFail("build") {
                val actual = getErrorMessages()
                assertEquals(expected = genKotlinErrorString(4, 7), actual = actual)
            }
        }
    }

    @DisplayName("should fail to add dependency into 'kapt' configuration when plugin is not applied")
    @GradleTest

Response:
fun testNoKaptPluginApplied(gradleVersion: GradleVersion) {
        project("nokapt".withPrefix, gradleVersion) {

            buildAndFail("build") {
                assertOutputContains("Could not find method kapt() for arguments")
            }
        }
    }

    @DisplayName("Should re-run kapt on changes in local annotation processor")
    @GradleTest<|endoftext|>


Prompt:
*          val tmp = liveLiteral(
 *              "String$arg-0$call-print$fun-Foo",
 *              this.`String$arg-0$call-print$fun-Foo`
 *          )
 *          this.`String$arg-0$call-print$fun-Foo` = tmp
 *          tmp
 *        } else field
 *        return field.value
 *      }

Response:
*    }
 *
 * @see DurableKeyVisitor
 */
open class LiveLiteralTransformer(
    private val liveLiteralsEnabled: Boolean,
    private val usePerFileEnabledFlag: Boolean,
    private val keyVisitor: DurableKeyVisitor,
    context: IrPluginContext,
    symbolRemapper: DeepCopySymbolRemapper,
    metrics: ModuleMetrics,<|endoftext|>


Prompt:
set(value) = definedExternally
    var deltaY: Double? /* = 0.0 */
        get() = definedExternally
        set(value) = definedExternally
    var deltaZ: Double? /* = 0.0 */
        get() = definedExternally
        set(value) = definedExternally
    var deltaMode: Int? /* = 0 */
        get() = definedExternally

Response:
set(value) = definedExternally
}

@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
@kotlin.internal.InlineOnly<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.lexer.KtKeywordToken
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
import org.jetbrains.kotlin.metadata.deserialization.VersionRequirement.Version

Response:
import org.jetbrains.kotlin.name.CallableId
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.KtAnnotationEntry<|endoftext|>


Prompt:
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
@Target(AnnotationTarget.VALUE_PARAMETER) annotation class base

<!WRONG_ANNOTATION_TARGET!>@base<!> annotation class derived

Response:
<!WRONG_ANNOTATION_TARGET!>@base<!> class correct(@base val x: Int, @base w: Int) {
    <!WRONG_ANNOTATION_TARGET!>@base<!> constructor(): this(0, 0)
}

<!WRONG_ANNOTATION_TARGET!>@base<!> enum class My {<|endoftext|>


Prompt:
val selector = JsAstUtils.newJsIf(amdTest, amdBody, JsAstUtils.newJsIf(commonJsTest, commonJsBody, plainBlock))
        adapterBody.statements += selector

        return listOf(JsInvocation(adapter, JsName("globalThis", false).makeRef(), function).makeStmt())
    }

    private fun wrapAmd(

Response:
function: JsExpression,
        importedModules: List<JsImportedModule>, program: JsProgram
    ): List<JsStatement> {
        val scope = program.scope
        val defineName = scope.declareName("define")
        val invocationArgs = listOf(<|endoftext|>


Prompt:
!inputChanges.isIncremental -> NotAvailableForNonIncrementalRun(classpathSnapshotFiles)
                // When `inputChanges.isIncremental == true`, we want to compile incrementally. However, if the incremental state (e.g.
                // lookup caches or previous classpath snapshot) is missing, we need to compile non-incrementally. There are a few cases:

Response:
//   1. Previous compilation happened using Kotlin daemon and with IC enabled (the usual case) => Incremental state
                //      including classpath snapshot must have been produced (we have that guarantee in `IncrementalCompilerRunner`).
                //   2. Previous compilation happened using Kotlin daemon but with IC disabled (e.g., by setting `kotlin.incremental=false`)<|endoftext|>


Prompt:
}
    }

    return LoweredIrWithExtraArtifacts(allModules, context, typeScriptFragment)
}

fun compileWasm(
    allModules: List<IrModuleFragment>,
    backendContext: WasmBackendContext,
    typeScriptFragment: TypeScriptFragment?,
    baseFileName: String,
    emitNameSection: Boolean = false,

Response:
allowIncompleteImplementations: Boolean = false,
    generateWat: Boolean = false,
    generateSourceMaps: Boolean = false,
): WasmCompilerResult {
    val compiledWasmModule = WasmCompiledModuleFragment(
        backendContext.irBuiltIns,<|endoftext|>


Prompt:
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.parsing.KotlinParserDefinition
import org.jetbrains.kotlin.script.loadScriptingPlugin
import org.jetbrains.kotlin.test.Directives
import org.jetbrains.kotlin.test.InTextDirectivesUtils

Response:
import org.jetbrains.kotlin.test.KotlinBaseTest
import org.jetbrains.kotlin.test.TestFiles
import org.jetbrains.kotlin.test.TestFiles.TestFileFactory
import org.jetbrains.kotlin.test.util.KtTestUtil
import java.io.File<|endoftext|>


Prompt:
import org.jetbrains.kotlin.resolve.jvm.KotlinJavaPsiFacade
import org.jetbrains.kotlin.scripting.compiler.plugin.repl.JvmReplCompilerState
import org.jetbrains.kotlin.scripting.compiler.plugin.repl.ReplCodeAnalyzerBase

Response:
import org.jetbrains.kotlin.scripting.compiler.plugin.repl.ReplImplicitsExtensionsResolutionFilter
import org.jetbrains.kotlin.scripting.definitions.ScriptDependenciesProvider
import org.jetbrains.kotlin.scripting.resolve.skipExtensionsResolutionForImplicits<|endoftext|>


Prompt:
// IGNORE_BACKEND: JS, JVM
// WITH_STDLIB

// MODULE: lib
// !LANGUAGE: +EnumEntries
// FILE: MyEnum.kt
enum class MyEnum {
    Nope, OK
}

// MODULE: main(lib)
// !LANGUAGE: +EnumEntries
// FILE: Box.kt

Response:
@OptIn(ExperimentalStdlibApi::class)
fun box(): String {
    return MyEnum.entries[1].toString()
}<|endoftext|>


Prompt:
import org.jetbrains.kotlin.psi.KtCodeFragment
import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.psi.KtThisExpression
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType

Response:
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.calls.util.isCallableReference
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe<|endoftext|>


Prompt:
var setter: SirSetter? = null

    fun build(): SirVariable {
        return SirVariableImpl(
            origin,
            visibility,
            documentation,
            name,
            type,
            getter,
            setter,
        )
    }

}

@OptIn(ExperimentalContracts::class)

Response:
inline fun buildVariable(init: SirVariableBuilder.() -> Unit): SirVariable {
    contract {
        callsInPlace(init, InvocationKind.EXACTLY_ONCE)
    }
    return SirVariableBuilder().apply(init).build()
}

@OptIn(ExperimentalContracts::class)
inline fun buildVariableCopy(original: SirVariable, init: SirVariableBuilder.() -> Unit): SirVariable {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer

internal class KtFirBackingFieldSymbolPointer(
    private val propertySymbolPointer: KtSymbolPointer<KtKotlinPropertySymbol>,

Response:
) : KtSymbolPointer<KtBackingFieldSymbol>() {
    @Deprecated("Consider using org.jetbrains.kotlin.analysis.api.KtAnalysisSession.restoreSymbol")
    override fun restoreSymbol(analysisSession: KtAnalysisSession): KtBackingFieldSymbol? {
        require(analysisSession is KtFirAnalysisSession)<|endoftext|>


Prompt:
return if (ktDeclaration.isVar) {
            specialSetter != null && specialGetter != null
        } else {
            specialGetter != null
        }
    }

    class PropertyAccessorsPsiMethods(
        val getter: PsiMethod?,
        val setter: PsiMethod?,
        val backingField: PsiField?,
        additionalAccessors: List<PsiMethod>

Response:
) : Iterable<PsiMethod> {
        private val allMethods: List<PsiMethod>
        val allDeclarations: List<PsiNamedElement>

        init {
            allMethods = arrayListOf()
            arrayOf(getter, setter).filterNotNullTo(allMethods)<|endoftext|>


Prompt:
* If you use this annotation, consider describing your use cases in [KT-58545](https://youtrack.jetbrains.com/issue/KT-58545) comments.
 *
 * # Migration
 *
 * Rewrite the code using explicit `actual typealias`. Unfortunately, it requires you to move your expect declarations into another

Response:
* package. Refer to [KT-58545](https://youtrack.jetbrains.com/issue/KT-58545) for more detailed migration example.
 */
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS)
@ExperimentalMultiplatform
@MustBeDocumented
@SinceKotlin("1.9")<|endoftext|>


Prompt:
samConvertedVars[irIndexVar] = irSamConvertedVar
        }

        irBlock.transformChildrenVoid(SamConversionsRewriter(samConvertedVars))
    }

    private fun createSamConvertedVarInitializer(irIndexVar: IrVariable, mostSpecificSamConversion: IrTypeOperatorCall): IrExpression {
        val irIndexVarInitializer = irIndexVar.initializer!!

Response:
val startOffset = irIndexVarInitializer.startOffset
        val endOffset = irIndexVarInitializer.endOffset

        val implicitCast = mostSpecificSamConversion.argument as IrTypeOperatorCall

        return IrTypeOperatorCallImpl(
            startOffset, endOffset,
            mostSpecificSamConversion.type,
            IrTypeOperator.SAM_CONVERSION,<|endoftext|>


Prompt:
assertEquals(listOf("three" to 20, "two" to 3), listOf("three" to 20, "two" to 3).sortedBy { it.first })
        assertEquals(listOf("three", "two"), listOf("two", "three").sortedByDescending { it.length })
    }

    @Test fun sortedNullableBy() {

Response:
fun String.nullIfEmpty() = if (isEmpty()) null else this
        listOf(null, "", "a").let {
            expect(listOf(null, "", "a")) { it.sortedWith(nullsFirst(compareBy { it })) }<|endoftext|>


Prompt:
val conditionExitNode = createLoopConditionExitNode(loop.condition, loop)
        val conditionBooleanValue = loop.condition.booleanLiteralValue
        popAndAddEdge(conditionExitNode)
        val blockEnterNode = lastNodes.pop()
        require(blockEnterNode is LoopBlockEnterNode)
        addBackEdge(conditionExitNode, blockEnterNode, isDead = conditionBooleanValue == false)

Response:
val loopExit = loopExitNodes.remove(loop)!!
        addEdge(conditionExitNode, loopExit, propagateDeadness = false, isDead = conditionBooleanValue == true)
        loopExit.updateDeadStatus()
        lastNodes.push(loopExit)
        return conditionExitNode to loopExit
    }

    // ----------------------------------- Boolean operators -----------------------------------<|endoftext|>


Prompt:
val candidatesWithAnnotation = candidates.filter {
                    it.resolvedCall.candidateDescriptor.annotations.hasAnnotation(OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION_FQ_NAME)
                }.toSet()
                val candidatesWithoutAnnotation = candidates - candidatesWithAnnotation
                if (candidatesWithAnnotation.isNotEmpty()) {

Response:
@Suppress("UNCHECKED_CAST")
                    val newCandidates = kotlinCallCompleter.chooseCandidateRegardingOverloadResolutionByLambdaReturnType(
                        maximallySpecificCandidates as Set<SimpleResolutionCandidate>,
                        resolutionCallbacks
                    )
                    maximallySpecificCandidates = overloadingConflictResolver.chooseMaximallySpecificCandidates(
                        newCandidates,<|endoftext|>


Prompt:
internal val DECLARATION_ORIGIN_INLINE_CLASS_SPECIAL_FUNCTION = IrDeclarationOriginImpl("INLINE_CLASS_SPECIAL_FUNCTION")

private fun IrClass.defaultOrNullableType(hasQuestionMark: Boolean) =
        if (hasQuestionMark) this.defaultType.makeNullable() else this.defaultType

Response:
internal fun Context.getBoxFunction(inlinedClass: IrClass): IrSimpleFunction = mapping.boxFunctions.getOrPut(inlinedClass) {
    require(inlinedClass.isUsedAsBoxClass())
    val classes = mutableListOf(inlinedClass)
    var parent = inlinedClass.parent
    while (parent is IrClass) {
        classes.add(parent)
        parent = parent.parent<|endoftext|>


Prompt:
namePrefix: String,
        buildTypes: Collection<NativeBuildType> = NativeBuildType.DEFAULT_BUILD_TYPES,
        configure: Framework.() -> Unit = {}
    ) = createBinaries(namePrefix, namePrefix, NativeOutputKind.FRAMEWORK, buildTypes, ::Framework, configure)

Response:
/** Creates an Objective-C framework with the empty name prefix for each build type and configures it. */
    @JvmOverloads
    fun framework(
        buildTypes: Collection<NativeBuildType> = NativeBuildType.DEFAULT_BUILD_TYPES,
        configure: Framework.() -> Unit = {}<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors
import org.jetbrains.kotlin.fir.expressions.FirPropertyAccessExpression
import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment

Response:
import org.jetbrains.kotlin.fir.expressions.toResolvedCallableSymbol
import org.jetbrains.kotlin.fir.resolve.calls.FirSimpleSyntheticPropertySymbol
import org.jetbrains.kotlin.fir.resolve.calls.noJavaOrigin<|endoftext|>


Prompt:
flagKind: FlagKind = FlagKind.REGULAR
    ) {
        for (flag in flagsToCompare) {
            val valueA = flag.get(flagsA)
            val valueB = flag.get(flagsB)

            compareValues(containerContext, valueA, valueB, flagKind, flag.name)
        }
    }

    companion object {
        fun compare(

Response:
metadataA: KlibModuleMetadata,
            metadataB: KlibModuleMetadata,
            config: Config = Config.Default
        ): Result = MetadataDeclarationsComparator(config).compareModules(metadataA, metadataB)

        private val CLASS_FLAGS: Array<KProperty1<KmClass, Any>> = arrayOf(
            KmClass::hasAnnotations,<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_PARAMETER

fun fooInt(p: Int) = p
fun fooLong(p: Long) = p
fun fooByte(p: Byte) = p
fun fooShort(p: Short) = p

fun test() {
    fooInt(1 % 1)

Response:
fooByte(<!ARGUMENT_TYPE_MISMATCH!>1 % 1<!>)
    fooLong(1 % 1)
    fooShort(<!ARGUMENT_TYPE_MISMATCH!>1 % 1<!>)
}

public operator fun Int.rem(other: Int): Int = 0<|endoftext|>


Prompt:
* @sample samples.collections.Collections.Transformations.distinctAndDistinctBy
 */
public fun DoubleArray.distinct(): List<Double> {
    return this.toMutableSet().toList()
}

/**
 * Returns a list containing only distinct elements from the given array.
 *
 * The elements in the resulting list are in the same order as they were in the source array.
 *

Response:
* @sample samples.collections.Collections.Transformations.distinctAndDistinctBy
 */
public fun BooleanArray.distinct(): List<Boolean> {
    return this.toMutableSet().toList()
}

/**
 * Returns a list containing only distinct elements from the given array.
 *
 * The elements in the resulting list are in the same order as they were in the source array.
 *<|endoftext|>


Prompt:
abstract class F : KotlinInterface, Java2 { //Kotlin ← Java, Kotlin2 ← Java2
    override fun getFirst(): Int {
        return 2
    }
}

abstract class G : Java3()  //Kotlin ← Java ← Kotlin ← Java

interface KotlinInterface : SequencedCollection<Int>

Response:
fun test(a: A, b: B, c: C, d: D, e: E, f: F, g: G) {
    a.addFirst(1)
    a.addLast(null)
    a.first
    a.last
    a.first()
    a.last()
    a.removeFirst()
    a.removeLast()
    a.reversed()<|endoftext|>


Prompt:
return "Wrong elements for (MaxL - 5).toLong()..MaxL step 3: $list4"
    }

    val list5 = ArrayList<Char>()
    val range5 = (MaxC - 5)..MaxC step 3
    for (i in range5) {
        list5.add(i)
        if (list5.size > 23) break
    }

Response:
if (list5 != listOf<Char>((MaxC - 5), (MaxC - 2))) {
        return "Wrong elements for (MaxC - 5)..MaxC step 3: $list5"
    }

    return "OK"
}<|endoftext|>


Prompt:
configuration.put(WasmConfigurationKeys.WASM_USE_TRAPS_INSTEAD_OF_EXCEPTIONS, arguments.wasmUseTrapsInsteadOfExceptions)
        configuration.put(WasmConfigurationKeys.WASM_USE_NEW_EXCEPTION_PROPOSAL, arguments.wasmUseNewExceptionProposal)

Response:
configuration.putIfNotNull(WasmConfigurationKeys.WASM_TARGET, arguments.wasmTarget?.let(WasmTarget::fromName))

        configuration.put(JSConfigurationKeys.OPTIMIZE_GENERATED_JS, arguments.optimizeGeneratedJs)

        val commonSourcesArray = arguments.commonSources
        val commonSources = commonSourcesArray?.toSet() ?: emptySet()<|endoftext|>


Prompt:
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtSimpleNameExpression

public abstract class KtCompletionCandidateChecker : KtAnalysisSessionComponent() {
    public abstract fun createExtensionCandidateChecker(
        originalFile: KtFile,
        nameExpression: KtSimpleNameExpression,

Response:
explicitReceiver: KtExpression?
    ): KtCompletionExtensionCandidateChecker

    @Deprecated("Use createExtensionCandidateChecker() instead.")
    public abstract fun checkExtensionFitsCandidate(
        firSymbolForCandidate: KtCallableSymbol,
        originalFile: KtFile,
        nameExpression: KtSimpleNameExpression,<|endoftext|>


Prompt:
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.ir.IrBuiltIns

Response:
import org.jetbrains.kotlin.ir.IrDiagnosticReporter
import org.jetbrains.kotlin.ir.KtDiagnosticReporterWithImplicitIrBasedContext
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.library.KotlinLibrary<|endoftext|>


Prompt:
override fun getAllClassesByClassId(classId: ClassId): List<KtClassOrObject> = emptyList()
    override fun getAllTypeAliasesByClassId(classId: ClassId): List<KtTypeAlias> = emptyList()
    override fun getTopLevelKotlinClassLikeDeclarationNamesInPackage(packageFqName: FqName): Set<Name> = emptySet()

Response:
override fun getTopLevelProperties(callableId: CallableId): List<KtProperty> = emptyList()
    override fun getTopLevelFunctions(callableId: CallableId): List<KtNamedFunction> = emptyList()
    override fun getTopLevelCallableFiles(callableId: CallableId): List<KtFile> = emptyList()<|endoftext|>


Prompt:
override val source: KtSourceElement?
    val diagnostic: ConeDiagnostic

    override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R =
        visitor.visitDiagnosticHolder(this, data)

    @Suppress("UNCHECKED_CAST")

Response:
override fun <E : FirElement, D> transform(transformer: FirTransformer<D>, data: D): E =
        transformer.transformDiagnosticHolder(this, data) as E
}<|endoftext|>


Prompt:
override fun MethodBuilder.modifyGeneratedXor() {
        setAsExternal(PrimitiveType.BOOLEAN)
    }

    override fun MethodBuilder.modifyGeneratedCompareTo() {
        setAsExternal(PrimitiveType.BOOLEAN)
    }

    override fun MethodBuilder.modifyGeneratedToString() {

Response:
"if (this) \"true\" else \"false\"".setAsExpressionBody()
    }

    override fun MethodBuilder.modifyGeneratedEquals() {
        "other is Boolean && kotlin.native.internal.areEqualByValue(this, other)".setAsExpressionBody()
    }

    private fun ClassBuilder.generateCustomEquals() {
        method {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrFunction
import org.jetbrains.kotlin.ir.expressions.IrBody

Response:
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression
import org.jetbrains.kotlin.ir.util.hasAnnotation
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNRESOLVED_REFERENCE -UNREACHABLE_CODE
// SKIP_TXT

/*
 * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
 *
 * SPEC VERSION: 0.1-544

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


Prompt:
fun case2() {
    try {
        throwException()
    } catch (e: ExcB) {
    } finally
<!SYNTAX!><!>}<!SYNTAX!><!>

// TESTCASE NUMBER: 3

fun case3() {
    try {
        throwException()
    } finally

Response: <!SYNTAX!><!>}<!SYNTAX!><!><|endoftext|>


Prompt:
resourceMap.put(res.id.name, res)
                }
            }
        }

        resourceMap.keys.removeAll(resourcesToExclude)
        return resourceMap.values.toList()
    }

    companion object {
        fun getInstance(module: Module): AndroidLayoutXmlFileManager? {
            @Suppress("DEPRECATION")

Response:
val service = com.intellij.openapi.module.ModuleServiceManager.getService(module, AndroidLayoutXmlFileManager::class.java)
            return service ?: module.getComponent(AndroidLayoutXmlFileManager::class.java)
        }
    }
}<|endoftext|>


Prompt: This could happen if the required dependency is missing in the project. Or if there is a dependency of "org.sample:libb (org.sample:libb-native)" that has a different version in the project than the version that "org.sample:libb (org.sample:libb-native): 1.0" was initially compiled with. Please check that the project configuration is correct and has consistent versions of all required dependencies.

Response:
The list of "org.sample:libb (org.sample:libb-native): 1.0" dependencies that may lead to conflicts:
            1. "org.sample:liba (org.sample:liba-native): 2.0" (was initially compiled with "org.sample:liba (org.sample:liba-native): 1.0")

            Project dependencies:<|endoftext|>


Prompt:
fun func() = "2"
}

fun box(): String {
    val expectedKeys = setOf("simpleProp", "anotherProp")
    assertEquals(expectedKeys, P().keys())

    assertEquals(expectedKeys, object {
        val simpleProp: Int = 100
        val anotherProp: Int = 100
        val propWithGetter: Int
            get() = 1

Response:
fun func() = "2"
    }.keys())

    return "OK"
}

fun Any.keys(): Set<String> = (js("Object").keys(this) as Array<String>).toSet()<|endoftext|>


Prompt:
} catch (e: java.lang.Exception) {
                log()
            } finally {
                x = 42
            }
        }

        // Properly initialized
        x.inc()
    } catch (e: java.lang.Exception) {
        log()
    }

    // Still can be unitialized because we don't know what can happen in try-block

Response:
// (e.g., OutOfMemory exception could've happened even before myRun was executed)
    <!UNINITIALIZED_VARIABLE!>x<!>.inc()
}

fun innerFinallyInitializesOuterRethrows() {
    val x: Int
    try {
        myRun {
            try {
                innerComputation()<|endoftext|>


Prompt:
++index
    }
    return res
}

@ExperimentalForeignApi
public fun NativePlacement.allocArrayOf(elements: ByteArray): CArrayPointer<ByteVar> {
    val result = allocArray<ByteVar>(elements.size)
    nativeMemUtils.putByteArray(elements, result.pointed, elements.size)
    return result
}

@ExperimentalForeignApi

Response:
public fun NativePlacement.allocArrayOf(vararg elements: Float): CArrayPointer<FloatVar> {
    val res = allocArray<FloatVar>(elements.size)
    var index = 0
    while (index < elements.size) {
        res[index] = elements[index]
        ++index
    }
    return res
}

@ExperimentalForeignApi<|endoftext|>


Prompt:
// Disabling toolchain feature for checking stable logic with downloading kotlin native
            freeArgs = listOf("-Pkotlin.native.toolchain.enabled=false"),
            // For each test in this class, we need to provide an isolated .konan directory,
            // so we create it within each test project folder
            konanDataDir = workingDir.resolve(".konan")
                .toFile()

Response:
.apply { mkdirs() }.toPath(),
        )

    @OptIn(EnvironmentalVariablesOverride::class)
    @DisplayName("K/N Gradle project build (on Linux or Mac) with a dependency from a Maven")
    @GradleTest
    fun testSetupCommonOptionsForCaches(gradleVersion: GradleVersion, @TempDir tempDir: Path) {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.parcelize.fir.diagnostics.KtErrorsParcelize.PARCELER_TYPE_INCOMPATIBLE
import org.jetbrains.kotlin.parcelize.fir.diagnostics.KtErrorsParcelize.PROPERTY_WONT_BE_SERIALIZED

Response:
import org.jetbrains.kotlin.parcelize.fir.diagnostics.KtErrorsParcelize.REDUNDANT_TYPE_PARCELER

object KtDefaultErrorMessagesParcelize : BaseDiagnosticRendererFactory() {
    override val MAP = KtDiagnosticFactoryToRendererMap("Parcelize").also { map ->
        map.put(<|endoftext|>


Prompt:
private object B260 { val a = B259.a + Random.nextInt(100) }
private object B261 { val a = B260.a + Random.nextInt(100) }
private object B262 { val a = B261.a + Random.nextInt(100) }
private object B263 { val a = B262.a + Random.nextInt(100) }

Response:
private object B264 { val a = B263.a + Random.nextInt(100) }
private object B265 { val a = B264.a + Random.nextInt(100) }
private object B266 { val a = B265.a + Random.nextInt(100) }
private object B267 { val a = B266.a + Random.nextInt(100) }<|endoftext|>


Prompt:
// !CHECK_TYPE

package n

import java.util.*
import checkSubtype

fun test() {
    val foo = arrayList("").map { it -> it.length }.fold(0, { x, y -> Math.max(x, y) })
    checkSubtype<Int>(foo)
    checkSubtype<String>(<!TYPE_MISMATCH!>foo<!>)
}

Response:
//from library
fun <T> arrayList(vararg values: T) : ArrayList<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!><|endoftext|>


Prompt:
public var b4: Int = 0
        public set

    private var b5 = 0
        private set

    init {
        a1 = 1
        a2 = 1
        a3 = 1

        b1 = 1
        b2 = 1
        b3 = 1
        b4 = 1
        b5 = 1
        foo { a1 = 1 }
        bar()
    }

Response:
private inline fun bar() { a1 = 1 }
}

inline fun foo(x: () -> Unit) = x()

// Every property should be accessed directly in this example because they all are final class properties with default accessors
// 0 INVOKESPECIAL Example\.set

// JVM_TEMPLATES
// ...except the access in `private inline fun`.
// 2 INVOKEVIRTUAL Example\.set<|endoftext|>


Prompt:
private fun maybeGetJavaCacheFromFile(): JavaClassCache {
        return if (javaCacheFile.exists()) {
            try {
                ObjectInputStream(BufferedInputStream(javaCacheFile.inputStream())).use {
                    it.readObject() as JavaClassCache
                }
            } catch (e: Throwable) {
                JavaClassCache()
            }
        } else {
            JavaClassCache()

Response:
}
    }

    override fun close() {
        if (closed) return

        with(javaCacheFile) {
            delete()
            parentFile.mkdirs()
            ObjectOutputStream(BufferedOutputStream(outputStream())).use {
                it.writeObject(javaCache)
            }
        }

        with(aptCacheFile) {
            delete()<|endoftext|>


Prompt:
override var bar: String = "barI3"

    override var baz: String = "bazI3"

    override fun bay(): String = "bayI3"
}

abstract class A : I3

@JsExport
fun getA(): I3 = object : A() {
    override val foo: String = "fooA"

Response:
override var bar: String = "barA"

    override var baz: String = "bazA"

    override fun bay(): String = "bayA"
}

open class B : A() {
    override val foo: String = "fooB"

    override var bar: String = "barB"

    override val baz: String = "bazB"<|endoftext|>


Prompt:
// TARGET_BACKEND: JVM
// WITH_STDLIB
// MODULE: lib
// FILE: JavaAnn.java

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
@interface JavaAnn {
    Class<?>[] args();
}

// MODULE: main(lib)

Response:
// FILE: 1.kt

class O
class K

@JavaAnn(args = arrayOf(O::class, K::class)) class MyClass

fun box(): String {
    val args = MyClass::class.java.getAnnotation(JavaAnn::class.java).args
    val argName1 = args[0].java.simpleName ?: "fail 1"<|endoftext|>


Prompt:
expression: IrFunctionAccessExpression,
        parameter: IrValueParameter
    ): IrExpression {

        return this.useAsArgument(expression.target.valueParameters[parameter.index])
    }

    override fun useAsVarargElement(element: IrExpression, expression: IrVararg): IrExpression =
        element.useAs(
            // Do not box primitive inline classes

Response:
if (icUtils.isTypeInlined(element.type) && !icUtils.isTypeInlined(expression.type) && !expression.type.isPrimitiveArray())
                irBuiltIns.anyNType
            else
                if (!expression.type.isPrimitiveArray()) irBuiltIns.anyNType else expression.varargElementType
        )
}<|endoftext|>


Prompt:
val mergedTable = mutableMapOf<String, SummaryBenchmark>()
        mergedTable.apply {
            currentBenchmarks.forEach { (name, current) ->
                // Check existance of benchmark in previous results.
                if (previousBenchmarks == null || name !in previousBenchmarks) {
                    getOrPut(name) { SummaryBenchmark(current, null) }
                } else {

Response:
val previousBenchmark = previousBenchmarks.getValue(name)
                    getOrPut(name) { SummaryBenchmark(current, previousBenchmarks[name]) }
                    // Explore change of status.
                    if (previousBenchmark.status != current.status) {
                        val statusChange = FieldChange("$name", previousBenchmark.status, current.status)
                        benchmarksWithChangedStatus.add(statusChange)
                    }<|endoftext|>


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

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


Prompt:
@kotlin.SinceKotlin @kotlin.WasExperimental public final operator fun rangeUntil(other: kotlin.Int): kotlin.ranges.IntRange { /* compiled code */ }

    @kotlin.SinceKotlin @kotlin.WasExperimental public final operator fun rangeUntil(other: kotlin.Long): kotlin.ranges.LongRange { /* compiled code */ }

Response: @kotlin.SinceKotlin @kotlin.WasExperimental public final operator fun rangeUntil(other: kotlin.Short): kotlin.ranges.IntRange { /* compiled code */ }<|endoftext|>


Prompt:
val parameterNameName = StandardNames.NAME
        }
    }

    object Callables {
        val suspend = "suspend".callableId(BASE_KOTLIN_PACKAGE)
        val coroutineContext = "coroutineContext".callableId(BASE_COROUTINES_PACKAGE)

        val clone = "clone".callableId(Cloneable)

Response:
val not = "not".callableId(Boolean)

        val contract = "contract".callableId(BASE_CONTRACTS_PACKAGE)
    }

    object Collections {
        val baseCollectionToMutableEquivalent: Map<ClassId, ClassId> = mapOf(
            StandardClassIds.Iterable to StandardClassIds.MutableIterable,<|endoftext|>


Prompt:
if (!!(<!USELESS_IS_CHECK!>x !is TypealiasNullableStringIndirect<!REDUNDANT_NULLABLE!>?<!><!>)) else {
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>?.<!UNRESOLVED_REFERENCE!>length<!>
    }
}

// TESTCASE NUMBER: 10
fun case_10(x: Nothing?) {
    if (!!(x !is Interface3)) else {<|endoftext|>


Prompt:
package org.jetbrains.kotlin.konan.file

val String.isJavaScript
    get() = this.endsWith(".js")

val String.isUnixStaticLib
    get() = this.endsWith(".a")

val String.isWindowsStaticLib
    get() = this.endsWith(".lib")

val String.isBitcode

Response: get() = this.endsWith(".bc")<|endoftext|>


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

import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycle.CoroutineStart.Default
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycle.CoroutineStart.Undispatched

Response:
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycle.ProjectConfigurationResult
import org.jetbrains.kotlin.gradle.utils.whenEvaluated
import org.jetbrains.kotlin.gradle.utils.CompletableFuture
import org.jetbrains.kotlin.gradle.utils.failures<|endoftext|>


Prompt:
if (!areEqual(MOCK_CLASSIFIERS, a[i], b[i]))
                return false
        }

        return true
    }

    private companion object {
        fun mockValueParams(vararg params: Pair<String, String>): List<CirValueParameter> {
            check(params.isNotEmpty())
            return params.map { (name, returnTypeClassId) ->

Response:
ValueParameterCommonizerTest.mockValueParam(
                    name = name,
                    returnTypeClassId = returnTypeClassId
                )
            }
        }
    }
}<|endoftext|>


Prompt:
case389 checkType { check<Char>()}
}
// TESTCASE NUMBER: 390
fun case390(){
   val case390 = '\uc2ff'
   <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char")!>case390<!>
   case390 checkType { check<Char>()}
}
// TESTCASE NUMBER: 391
fun case391(){

Response:
val case391 = '\uc300'
   <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char")!>case391<!>
   case391 checkType { check<Char>()}
}
// TESTCASE NUMBER: 392
fun case392(){
   val case392 = '\uc3ff'<|endoftext|>


Prompt:
import org.jetbrains.kotlin.library.metadata.resolver.impl.KotlinLibraryResolverImpl
import org.jetbrains.kotlin.library.metadata.resolver.impl.libraryResolver
import org.jetbrains.kotlin.library.packageFqName
import org.jetbrains.kotlin.library.toUnresolvedLibraries

Response:
import org.jetbrains.kotlin.native.interop.gen.*
import org.jetbrains.kotlin.native.interop.indexer.*
import org.jetbrains.kotlin.native.interop.tool.*
import org.jetbrains.kotlin.util.removeSuffixIfPresent
import org.jetbrains.kotlin.util.suffixIfNot<|endoftext|>


Prompt:
startIndex: Int = 0,
        endIndex: Int = source.size
    ): A {
        val stringResult = platformEncodeToString(source, startIndex, endIndex)
        destination.append(stringResult)
        return destination
    }

    /**
     * Decodes symbols from the specified [source] array or its subrange.
     * Returns a [ByteArray] containing the resulting bytes.
     *

Response:
* The symbols for decoding are not required to be padded.
     * However, if there is a padding character present, the correct amount of padding character(s) must be present.
     * The padding character `'='` is interpreted as the end of the encoded byte data. Subsequent symbols are prohibited.
     *
     * @param source the array to decode symbols from.<|endoftext|>


Prompt:
loadClass(StandardClassIds.KFunctionN(arity)).owner
    }

    @OptIn(UnsafeDuringIrConstructionAPI::class)
    override fun suspendFunctionN(arity: Int): IrClass = suspendFunctionNMap.getOrPut(arity) {
        loadClass(StandardClassIds.SuspendFunctionN(arity)).owner
    }

Response:
@OptIn(UnsafeDuringIrConstructionAPI::class)
    override fun kSuspendFunctionN(arity: Int): IrClass = kSuspendFunctionNMap.getOrPut(arity) {
        loadClass(StandardClassIds.KSuspendFunctionN(arity)).owner
    }<|endoftext|>


Prompt:
is KtValueArgument -> {
            val valueArgumentList = argument.parent as? KtValueArgumentList ?: return null
            valueArgumentList.parent as? KtCallExpression ?: return null
        }
        else -> return null
    }

    val call = callExpression.getResolvedCall(bindingContext) ?: return null

Response:
return call.resultingDescriptor.name.asString()
}

private val ARRAY_OF_STRINGS_TYPE = Type.getType("[Ljava/lang/String;")
private val METHOD_DESCRIPTOR_FOR_MAIN = Type.getMethodDescriptor(Type.VOID_TYPE, ARRAY_OF_STRINGS_TYPE)

fun generateBridgeForMainFunctionIfNecessary(<|endoftext|>


Prompt:
visitContractDescriptionElement(booleanExpression, data)

    open fun visitLogicalBinaryOperationContractExpression(binaryLogicExpression: KtBinaryLogicExpression<Type, Diagnostic>, data: D): R =
        visitBooleanExpression(binaryLogicExpression, data)

Response:
open fun visitLogicalNot(logicalNot: KtLogicalNot<Type, Diagnostic>, data: D): R = visitBooleanExpression(logicalNot, data)

    open fun visitIsInstancePredicate(isInstancePredicate: KtIsInstancePredicate<Type, Diagnostic>, data: D): R =
        visitBooleanExpression(isInstancePredicate, data)<|endoftext|>


Prompt:
parameters = listOf(ObjCParameter("zone", null, ObjCRawType("struct _NSZone *"), null)),
                attributes = listOf("unavailable")
            )
        )
    }

    // Hide "unimplemented" super constructors:
    getSuperClassSymbolNotAny()?.getMemberScope()?.getConstructors().orEmpty()

Response:
.filter { it.isVisibleInObjC() }
        .forEach { superClassConstructor ->
            val translatedSuperClassConstructor = superClassConstructor.buildObjCMethod(unavailable = true)
            if (result.none { it.name == translatedSuperClassConstructor.name }) {
                result.add(translatedSuperClassConstructor)
            }
        }

    return result
}

/**<|endoftext|>


Prompt:
Assert.assertArrayEquals(msg, arrayOf(exp.value), arrayOf(actVal)) // tricking Array.deepEquals to compare single element arrays (instead of tedious casting to typed array)
                }
                else {
                    Assert.assertEquals(msg, exp.value, actVal)
                }
            }
        }
    }
}

Response:
private fun foo(i: Int, b: Byte, c: Char, d: Double = 0.0, s: String = "", t: Boolean = true, vararg v: Long) {}

private fun charArray(c: CharArray) {}

private fun varargStrings(vararg s: String) {}

private fun notNullNumber(n: Number) {}

private fun nullableNumber(n: Number?) {}<|endoftext|>


Prompt:
assertFails("KClass (not Class) instances should be passed as arguments") {
        create<TwoNonDefaults>(mapOf("clazz" to String::class.java, "string" to "Fail"))
    }

    val t5 = create<TwoNonDefaults>(mapOf("clazz" to String::class, "string" to "OK"))
    assertEquals("OK", t5.string)

Response:
val t6 = create<ManyDefaultParams>()
    assertEquals(0, t6.i)
    assertEquals("", t6.s)
    assertEquals(3.14, t6.d)

    return "OK"
}<|endoftext|>


Prompt:
isOperandOfIsOperator = true
        return try {
            block()
        } finally {
            isOperandOfIsOperator = oldValue
        }
    }

    @PrivateForInline
    @JvmField
    var currentFile: FirFile? = null

    @OptIn(PrivateForInline::class)

Response:
inline fun <R> withFile(file: FirFile?, block: FirSpecificTypeResolverTransformer.() -> R): R {
        val oldValue = currentFile
        currentFile = file
        return try {
            block()
        } finally {
            currentFile = oldValue
        }
    }

    @OptIn(PrivateForInline::class)<|endoftext|>


Prompt:
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtTestModule
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtTestModuleStructure
import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModuleStructureFactory


Prompt:
private fun KotlinHierarchyBuilderImpl.checkCyclicHierarchy(): Nothing? {
    val stack = mutableListOf(node)
    val visited = hashSetOf<KotlinHierarchyBuilderImpl>()

    fun checkChild(child: KotlinHierarchyBuilderImpl) {
        if (!visited.add(child)) return
        stack += child.node

Response:
if (this == child) throw CyclicKotlinHierarchyException(stack)
        child.children.forEach { next -> checkChild(next) }
        stack -= child.node
    }

    children.forEach { child -> checkChild(child) }
    return null
}<|endoftext|>


Prompt:
BasicJvmScriptingHost().eval(
                script.toScriptSource(), definition.compilationConfiguration, definition.evaluationConfiguration
            ).throwOnFailure()
        }.lines()
        Assert.assertEquals(greeting, output)
    }

    @Test
    fun testSimpleImportWithImplicitReceiverRef() {

Response:
val greeting = listOf("Hello from helloWithVal script!", "Hello from imported helloWithVal script!")
        val script = "println(\"Hello from imported \${(::helloScriptName).get()} script!\")"
        val definition = createJvmScriptDefinitionFromTemplate<SimpleScriptTemplate>(
            compilation = {
                makeSimpleConfigurationWithTestImport()
                implicitReceivers(String::class)
            },<|endoftext|>


Prompt:
val overridden = functionReferenceClass.superTypes.mapNotNull { superType ->
                        superType.getClass()
                                ?.declarations
                                ?.filterIsInstance<IrSimpleFunction>()
                                ?.singleOrNull { it.name.asString() == name }
                                ?.symbol
                    }
                    require(overridden.isNotEmpty())
                    val function = functionReferenceClass.addFunction {

Response:
startOffset = SYNTHETIC_OFFSET
                        endOffset = SYNTHETIC_OFFSET
                        this.name = Name.identifier(name)
                        modality = Modality.FINAL
                        returnType = overridden[0].owner.returnType
                    }
                    function.createDispatchReceiverParameter()
                    function.overriddenSymbols += overridden<|endoftext|>


Prompt:
C::nullableProduce.callSuspend(c)!!.value2
    }.let { assertEquals(-2, it) }

    run0U {
        C::nonNull_nonNullConsumeAndProduce.callSuspend(c, Z(3U, -3)).value1
    }.let { assertEquals(3U, it) }
    run0 {

Response:
C::nonNull_nonNullConsumeAndProduce.callSuspend(c, Z(3U, -3)).value2
    }.let { assertEquals(-3, it) }

    run0U {
        C::nonNull_nullableConsumeAndProduce.callSuspend(c, Z(4U, -4))!!.value1<|endoftext|>


Prompt:
fun ul(init : UL.() -> Unit) = initTag(UL(), init)
  fun a(href : String, init : A.() -> Unit) {
    val a = initTag(A(), init)
    a.href = href
  }
}

class Body() : BodyTag("body")
class UL() : BodyTag("ul") {

Response:
fun li(init : LI.() -> Unit) = initTag(LI(), init)
}

class B() : BodyTag("b")
class LI() : BodyTag("li")
class P() : BodyTag("p")
class H1() : BodyTag("h1")
class A() : BodyTag("a") {
  public var href : String?
    get() = attributes["href"]<|endoftext|>


Prompt:
skipIgnored,
    tags
).let { methodModel ->
    if (methodModel.containsWithoutJvmInline()) {
        val isWithAnnotationAndIsWithPostfix = when {
            targetBackend.isRecursivelyCompatibleWith(TargetBackend.JVM) -> listOf(true to false)
            targetBackend == TargetBackend.ANY -> listOf(null to false)

Response:
else -> listOf(false to false)
        }
        isWithAnnotationAndIsWithPostfix.map { (ann, post) -> WithoutJvmInlineTestMethodModel(methodModel, ann, post) }
    } else listOf(methodModel)
}<|endoftext|>


Prompt:
* @param diagnosticReporter Used for reporting serialization-time diagnostics, for example, about clashing IR signatures.
 * @param compatibilityMode The information about KLIB ABI.
 * @param cleanFiles In the case of incremental compilation, the list of files that were not changed and therefore don't need to be
 *     serialized again.
 * @param dependencies The list of KLIBs that the KLIB being produced depends on.

Response:
* @param createModuleSerializer Used for creating a backend-specific instance of [IrModuleSerializer].
 * @param metadataSerializer Something capable of serializing the metadata of the source files. See the corresponding interface KDoc.
 * @param runKlibCheckers Additional checks to be run before serializing [irModuleFragment]. Can be used to report serialization-time
 *     diagnostics.<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.types.coneTypeSafe
import org.jetbrains.kotlin.fir.types.isArrayType
import org.jetbrains.kotlin.fir.types.resolvedType
import org.jetbrains.kotlin.fir.visitors.FirDefaultTransformer

/**

Response:
* A transformer that converts resolved arrayOf() call to [FirArrayLiteral].
 *
 * Note that arrayOf() calls only in [FirAnnotation] or the default value of annotation constructor are transformed.
 */
class FirArrayOfCallTransformer : FirDefaultTransformer<FirSession>() {
    private fun toArrayLiteral(functionCall: FirFunctionCall, session: FirSession): FirExpression? {<|endoftext|>


Prompt:
private fun addFieldsForEnumEntries(result: MutableList<KtLightField>, classOrObjectSymbol: KtNamedClassOrObjectSymbol) {
        if (!isEnum) return

        classOrObjectSymbol.getStaticDeclaredMemberScope().getCallableSymbols()
            .filterIsInstance<KtEnumEntrySymbol>()
            .mapNotNullTo(result) {

Response:
val enumEntry = it.sourcePsiSafe<KtEnumEntry>()
                val name = enumEntry?.name ?: return@mapNotNullTo null
                SymbolLightFieldForEnumEntry(
                    enumEntry = enumEntry,
                    enumEntryName = name,
                    containingClass = this,
                )
            }
    }

    override fun isInterface(): Boolean = false<|endoftext|>


Prompt:
diagnosticHolder: KotlinDiagnosticsHolder,
    ): ReturnArgumentsAnalysisResult {
        val substitutorAndStubsForLambdaAnalysis = c.createSubstituteFunctorForLambdaAnalysis()
        val substitute = substitutorAndStubsForLambdaAnalysis.substitute

        // Expected type has a higher priority against which lambda should be analyzed

Response:
// Mostly, this is needed to report more specific diagnostics on lambda parameters
        fun expectedOrActualType(expected: UnwrappedType?, actual: UnwrappedType?): UnwrappedType? {
            val expectedSubstituted = expected?.let(substitute)<|endoftext|>


Prompt:
}.filterIsInstance<TestRunCheck.Result.Failed>()
        if (!testRun.expectedFailure) {
            verifyExpectation(failedResults.isEmpty()) {
                failedResults.joinToString("\n")
            }
        } else {
            val runResultInfo = buildString {
                appendLine("TestCase Kind: ${testRun.testCase.kind}")

Response:
appendLine("TestCaseId: ${testRun.testCase.id}")
                appendLine("Exit code: ${runResult.exitCode}")
                appendLine("Filtered test output is")
                appendLine(runResult.processOutput.stdOut.filteredOutput.let {
                    if (it.isNotEmpty()) ":\n$it" else " empty."
                })<|endoftext|>


Prompt:
if (field[i, j])
        // (i, j) is alive
            n in 2..3 // It remains alive iff it has 2 or 3 neighbors
        else
        // (i, j) is dead
            n == 3 // A new cell is born if there are 3 neighbors alive
    }
}

/** A few colony examples here */
fun main(args: Array<String>) {
    // Simplistic demo

Response:
printField("***", 3)
    // "Star burst"
    printField("""
    __*__
    _***_
    __*__
  """, 10)
    // Stable colony
    printField("""
    __*__
    _*_*_
    __*__
  """, 3)
    // Stable from the step 2
    printField("""
    __**__<|endoftext|>


Prompt:
processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction
    ): ProcessorAction =
        doProcessDirectOverriddenCallables(
            functionSymbol, processor, enhancedToOriginalFunctions, FirTypeScope::processDirectOverriddenFunctionsWithBaseScope
        )

    override fun processDirectOverriddenPropertiesWithBaseScope(
        propertySymbol: FirPropertySymbol,

Response:
processor: (FirPropertySymbol, FirTypeScope) -> ProcessorAction
    ): ProcessorAction = doProcessDirectOverriddenCallables(
        propertySymbol, processor, enhancedToOriginalProperties, FirTypeScope::processDirectOverriddenPropertiesWithBaseScope
    )

    private fun <S : FirCallableSymbol<*>> doProcessDirectOverriddenCallables(
        callableSymbol: S,<|endoftext|>


Prompt:
val descriptor = resolvedCall.resultingDescriptor
        if (descriptor !is PropertyDescriptor || descriptor.name.asString() != "javaClass") return

        val container = descriptor.containingDeclaration
        if (container !is PackageFragmentDescriptor || container.fqName.asString() != "kotlin.jvm") return

        val actualType = descriptor.type

Response:
val companionObject = actualType.arguments.singleOrNull()?.type?.constructor?.declarationDescriptor as? ClassDescriptor ?: return
        if (companionObject.isCompanionObject) {
            val containingClass = companionObject.containingDeclaration as ClassDescriptor
            val javaLangClass = actualType.constructor.declarationDescriptor as? ClassDescriptor ?: return<|endoftext|>


Prompt:
if (suspendNoninlineReturnsVCStringNullable_Null() != null) throw IllegalStateException("suspendNoninlineReturnsVCStringNullable_Null")

    if (suspendNoninlineReturnsVCAny_Null() != null) throw IllegalStateException("suspendNoninlineReturnsVCAny_Null")

Response:
if (suspendNoninlineReturnsVCAnyNullable_Null() != null) throw IllegalStateException("suspendNoninlineReturnsVCAnyNullable_Null")

    if (suspendNoninlineReturnsVCInt_Null() != null) throw IllegalStateException("suspendNoninlineReturnsVCInt_Null")<|endoftext|>


Prompt:
if (!correctErrorTypes) {
            return defaultSuperTypes
        }

        val declaration = kaptContext.origins[clazz]?.element as? KtClassOrObject ?: return defaultSuperTypes
        val declarationDescriptor = kaptContext.bindingContext[BindingContext.CLASS, declaration] ?: return defaultSuperTypes

Response:
if (typeMapper.mapType(declarationDescriptor.defaultType) != Type.getObjectType(clazz.name)) {
            return defaultSuperTypes
        }

        val (superClass, superInterfaces) = partitionSuperTypes(declaration) ?: return defaultSuperTypes

        val sameSuperClassCount = (superClass == null) == (defaultSuperTypes.superClass == null)<|endoftext|>


Prompt:
// WITH_STDLIB
// MODULE: lib
// FILE: common.kt

enum class FooEnum(val s: String) {
    O("O"),
    FAIL("FAIL"),
    K("K");
}

// MODULE: bar(lib)
// FILE: second.kt

fun bar(): String = FooEnum.valueOf("O").s + FooEnum.values()[2].s

Response:
// MODULE: main(bar)
// FILE: main.kt

fun box(): String {
    return bar()
}<|endoftext|>


Prompt:
d <!DEBUG_INFO_DYNAMIC!>+=<!> 1
    d <!DEBUG_INFO_DYNAMIC!>-=<!> 1
    d <!DEBUG_INFO_DYNAMIC!>*=<!> 1
    d <!DEBUG_INFO_DYNAMIC!>/=<!> 1

Response:
d <!DEBUG_INFO_DYNAMIC!>%=<!> 1

    <!DEBUG_INFO_DYNAMIC!>d[1]<!> <!DEBUG_INFO_DYNAMIC!>+=<!> 1
    <!DEBUG_INFO_DYNAMIC!>d[1]<!> <!DEBUG_INFO_DYNAMIC!>-=<!> 1<|endoftext|>


Prompt:
Opcodes.IF_ICMPEQ -> Opcodes.IFEQ
                        Opcodes.IF_ICMPNE -> Opcodes.IFNE
                        Opcodes.IF_ICMPLE -> Opcodes.IFLE
                        Opcodes.IF_ICMPLT -> Opcodes.IFLT
                        Opcodes.IF_ICMPGE -> Opcodes.IFGE

Response:
Opcodes.IF_ICMPGT -> Opcodes.IFGT
                        else -> throw AssertionError("Unexpected instruction: ${insn.insnText}")
                    }
                    set(insn, JumpInsnNode(cmpWith0Opcode, insn.label))
                }
            }
        }
    }<|endoftext|>


Prompt:
sourceModules.flatMapToSet { module -> module.files.map { "-Xfragment-sources=${module.name}:${it.location.path}" } }
                .sorted().forEach { add(it) }
        }
    }
}

internal class LibraryCompilation(
    settings: Settings,
    freeCompilerArgs: TestCompilerArgs,

Response:
sourceModules: Collection<TestModule>,
    dependencies: Iterable<TestCompilationDependency<*>>,
    expectedArtifact: KLIB
) : SourceBasedCompilation<KLIB>(
    targets = settings.get(),
    home = settings.get(),
    classLoader = settings.get(),
    optimizationMode = settings.get(),
    compilerOutputInterceptor = settings.get(),<|endoftext|>


Prompt:
else -> "Fail: not Derived"
        }
    }
}

class Derived_1: Base() {
    override val a: CharSequence
        get() = "Fail: Derived_1"
}

class Derived_2: Base() {
    override val a: CharSequence
        get() = "OK"
}

fun box(): String {

Response:
val x = Derived_2()
    return x.test(x)
}<|endoftext|>


Prompt:
private fun getPreviousIncludingSubGraphInstructions(
    instruction: Instruction,
    traversalOrder: TraversalOrder,
    startInstruction: Instruction,
    previousSubGraphInstructions: Collection<Instruction>
): Collection<Instruction> {
    val previous = instruction.getPreviousInstructions(traversalOrder)
    if (instruction != startInstruction || previousSubGraphInstructions.isEmpty()) {

Response:
return previous
    }
    val result = ArrayList(previous)
    result.addAll(previousSubGraphInstructions)
    return result
}

private fun <I : ControlFlowInfo<*, *, *>> updateEdgeDataForInstruction(
    instruction: Instruction,
    previousValue: Edges<I>?,
    newValue: Edges<I>?,<|endoftext|>


Prompt:
else -> privateSymbolFactory().also {
                it.privateSignature = signature
            }
        }
    }

    // ------------------------------------ property ------------------------------------

    fun declareProperty(
        signature: IdSignature,
        symbolFactory: () -> IrPropertySymbol,
        propertyFactory: (IrPropertySymbol) -> IrProperty,
    ): IrProperty {
        return propertySlice.declare(

Response:
signature,
            symbolFactory,
            propertyFactory
        )
    }

    fun declarePropertyIfNotExists(
        signature: IdSignature,
        symbolFactory: () -> IrPropertySymbol,
        propertyFactory: (IrPropertySymbol) -> IrProperty,
    ): IrProperty {
        return propertySlice.declareIfNotExists(signature, symbolFactory, propertyFactory)<|endoftext|>


Prompt:
cacheKind: String
): File {
    val cacheBaseName = CachedLibraries.getCachedLibraryName(libraryName)
    val cacheOutputKind = CompilerOutputKind.valueOf(cacheKind.uppercase())
    return OutputFiles(cacheDirectory.child(cacheBaseName).absolutePath, target, cacheOutputKind).mainFile
}

private fun buildCache(
        target: KonanTarget,

Response:
def: DefFile,
        outputDirectory: File,
        cacheInfo: CacheInfo,
        rebuild: Boolean,
        logger: Logger
) = with(cacheInfo) {
    val libraryCacheDir = getLibraryCacheDir(def.name, target, cacheDirectory, cacheKind)
    if (libraryCacheDir.listFilesOrEmpty.isNotEmpty() && !rebuild) {<|endoftext|>


Prompt:
is SubAandB -> 1
    }
    return i
}

fun testIntersection(both: A): Int {
    check(both is B)

    var i = 0
    i += <!NO_ELSE_IN_WHEN!>when<!>(both) {
        is SubAandB -> 1
    }
    i += when(both) {

Response:
<!USELESS_IS_CHECK!>is SubB<!> -> 1
        is SubAandB -> 1
    }
    i += when(both) {
        <!USELESS_IS_CHECK!>is SubA<!> -> 1
        is SubAandB -> 1
    }
    i += when(both) {<|endoftext|>


Prompt:
stackTrace.joinToString(separator = "\n")) }
    }

    fun checkStateMachineIn(method: String) {
        stackTrace.find { it?.methodName?.startsWith(method) == true } ?: error("tail-call optimization hit: method " + method + " has no state-machine " +

Response:
stackTrace.joinToString(separator = "\n"))
    }
}

val TailCallOptimizationChecker = TailCallOptimizationCheckerClass()<|endoftext|>


Prompt:
fun setDesiredAssertionStatus(v: Boolean): Checker {
    val loader = Checker::class.java.classLoader
    loader.setPackageAssertionStatus("localAnonymousFunction", v)
    val c = loader.loadClass(if (v) "localAnonymousFunction.ShouldBeEnabled" else "localAnonymousFunction.ShouldBeDisabled")
    return c.newInstance() as Checker
}

Response:
fun box(): String {
    var c = setDesiredAssertionStatus(false)
    if (c.checkTrue()) return "FAIL 0"
    if (c.checkTrueWithMessage()) return "FAIL 1"
    if (c.checkFalse()) return "FAIL 2"
    if (c.checkFalseWithMessage()) return "FAIL 3"
    c = setDesiredAssertionStatus(true)<|endoftext|>


Prompt:
private fun translateForPropertyAccessor(
            call: ResolvedCall<out PropertyDescriptor>,
            expression: KtExpression,
            descriptor: PropertyDescriptor,
            context: TranslationContext,
            receiver: JsExpression?,
            isSetter: Boolean,

Response:
translator: (TranslationContext, ResolvedCall<out PropertyDescriptor>, JsExpression, JsExpression?) -> JsExpression
    ): JsExpression {
        val accessorFunction = JsFunction(context.scope(), JsBlock(), "")
        accessorFunction.source = expression
        val accessorContext = context.innerBlock(accessorFunction.body)<|endoftext|>


Prompt:
internal fun <T : Any> createAnnotationInstance(
    annotationClass: Class<T>,
    values: Map<String, Any>,
    methods: List<ReflectMethod> = values.keys.map { name -> annotationClass.getDeclaredMethod(name) }
): T {
    fun equals(other: Any?): Boolean =
        (other as? Annotation)?.annotationClass?.java == annotationClass &&

Response:
methods.all { method ->
                    val ours = values[method.name]
                    val theirs = method(other)
                    when (ours) {
                        is BooleanArray -> ours contentEquals theirs as BooleanArray
                        is CharArray -> ours contentEquals theirs as CharArray
                        is ByteArray -> ours contentEquals theirs as ByteArray
                        is ShortArray -> ours contentEquals theirs as ShortArray<|endoftext|>


Prompt:
override fun serialize(value: Extras): ByteArray = IdeaExtrasProto(value).toByteArray()
    override fun deserialize(data: ByteArray): Extras = Extras(IdeaExtrasProto.parseFrom(data))
    override fun normalize(value: Extras): Extras = value.filter { (_, value) -> value !is Ignored }.toExtras()

    class Ignored

Response:
@Test
    fun `serialize - deserialize - sample 0`() {

        val extras = mutableExtrasOf(
            extrasKeyOf<String>() withValue "myValue",
            extrasKeyOf<String>("a") withValue "myValueA",
            extrasKeyOf<Int>() withValue 2411,
            extrasKeyOf<Ignored>() withValue Ignored()<|endoftext|>


Prompt:
private const val ADVANCED_ARGUMENT_PREFIX = "-X"
private const val FREE_ARGS_DELIMITER = "--"

data class ArgumentParseErrors(
    val unknownArgs: MutableList<String> = SmartList(),

    val unknownExtraFlags: MutableList<String> = SmartList(),

Response:
// Names of extra (-X...) arguments which have been passed in an obsolete form ("-Xaaa bbb", instead of "-Xaaa=bbb")
    val extraArgumentsPassedInObsoleteForm: MutableList<String> = SmartList(),

    // Non-boolean arguments which have been passed multiple times, possibly with different values.
    // The key in the map is the name of the argument, the value is the last passed value.<|endoftext|>


Prompt:
node.remove(InsnSequence(capturedFieldAccess[0], insnNode))
            return capturedFieldAccess[capturedFieldAccess.size - 1]
        }

        return null
    }

    protected open fun getFieldNameForFolding(insnNode: FieldInsnNode): String = insnNode.name

    @JvmOverloads

Response:
open fun findField(fieldInsnNode: FieldInsnNode, captured: Collection<CapturedParamInfo> = parameters.captured): CapturedParamInfo? {
        for (valueDescriptor in captured) {
            if (valueDescriptor.originalFieldName == fieldInsnNode.name && valueDescriptor.containingLambdaName == fieldInsnNode.owner) {
                return valueDescriptor
            }<|endoftext|>


Prompt:
if (context.languageVersionSettings.getFlag(JvmAnalysisFlags.suppressMissingBuiltinsError)) return

        val descriptor = resolvedCall.resultingDescriptor
        val error = diagnosticFor(descriptor, reportOn)
            ?: diagnosticFor(descriptor.returnType?.takeUnless(this::isComputingDeferredType)?.constructor?.declarationDescriptor, reportOn)

Response:
error?.let(context.trace::report)
    }

    private fun diagnosticFor(descriptor: DeclarationDescriptor?, reportOn: PsiElement): Diagnostic? {
        if (descriptor == null) return null

        val containingClassOrPackage = DescriptorUtils.getParentOfType(descriptor, ClassOrPackageFragmentDescriptor::class.java)<|endoftext|>


Prompt:
* It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.
 *
 * @param destination the array to copy to.
 * @param destinationOffset the position in the [destination] array to copy to, 0 by default.
 * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.

Response:
* @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.<|endoftext|>


Prompt:
firDiagnostic as KtPsiDiagnostic,
            token,
        )
    }
    add(FirErrors.ACTUAL_MISSING) { firDiagnostic ->
        ActualMissingImpl(
            firDiagnostic as KtPsiDiagnostic,
            token,
        )
    }

Response:
add(FirErrors.EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING) { firDiagnostic ->
        ExpectActualClassifiersAreInBetaWarningImpl(
            firDiagnostic as KtPsiDiagnostic,
            token,
        )
    }<|endoftext|>


Prompt: // test.kt:46 box: xFoo\24:int=1:int, $i$f$foo\24\42:int=0:int, it\42:int=2:int, $i$a$-foo-TestKt$box$4\42\266\0:int=0:int

Response: // test.kt:47 box: xFoo\24:int=1:int, $i$f$foo\24\42:int=0:int, it\42:int=2:int, $i$a$-foo-TestKt$box$4\42\266\0:int=0:int, y2\42:int=2:int<|endoftext|>


Prompt:
require(x is String)
    for (i in 1..10) {
        x.length
        for (j in 1..10) {
            x.length
        }
        x += ""
    }
}

fun test33() {
    var x: Any? = materialize()
    require(x is Int)
    for (i in 1..10) {
        x.inc()

Response:
for (j in 1..10) {
            x.inc()
        }
        x++
    }
}

// Result is saved in var

fun test34() {
    var x: Any? = materialize()
    val state: Boolean = x is String
    for(i in 1..10) {
        if (state) {
            x.length
        }
    }
}<|endoftext|>


Prompt:
importsToAdd = listOf("org.jetbrains.kotlin.fir.declarations.FirTypeParameter")
        ),
        FirValueParameter::class to HLFunctionCallConversion(
            "firSymbolBuilder.buildSymbol({0}.symbol)",
            KtSymbol::class.createType(),

Response:
importsToAdd = listOf("org.jetbrains.kotlin.fir.declarations.FirDeclaration")
        ),
        FirFunction::class to HLFunctionCallConversion(
            "firSymbolBuilder.buildSymbol({0})",
            KtSymbol::class.createType(),<|endoftext|>


Prompt:
description = "Path to konan and dependencies root folder")

    argParser.parse(args)

    val distribution = Distribution(
            KotlinNativePaths.homePath.absolutePath,
            onlyDefaultProfiles = false,
            runtimeFileOverride = null,
            propertyOverrides = parseKeyValuePairs(overrideKonanProperties),
            konanDataDir = konanDataDir

Response:
)

    val platformManager = PlatformManager(distribution)
    val target = platformManager.targetByName(targetName)
    val targetCacheArgs = platformManager.let {
        target.let(it::loader).additionalCacheFlags
    }
    val inputDirectory = inputDirectoryPath?.File()
            ?: File(distribution.konanSubdir, "platformDef").child(target.visibleName)<|endoftext|>


Prompt:
"()" + type.descriptor,
                false
            )
        }
    }

    // Type.CHAR_TYPE -> "Char"
    private fun getKotlinPrimitiveClassName(type: Type): Name {
        return JvmPrimitiveType.get(type.className).primitiveType.typeName
    }

    // "Char" -> type for kotlin.collections.CharIterator

Response:
private fun getPrimitiveIteratorType(primitiveClassName: Name): Type {
        val iteratorName = Name.identifier(primitiveClassName.asString() + "Iterator")
        return Type.getObjectType(COLLECTIONS_PACKAGE_FQ_NAME.child(iteratorName).internalNameWithoutInnerClasses)
    }
}<|endoftext|>


Prompt:
private var topStackStart: Int = 0

    fun buildFor(exception: Throwable): String {
        exception.dumpFullTrace("", "")
        return target.toString()
    }

    private fun hasSeen(exception: Throwable): Boolean = visited.any { it === exception }

    private fun Throwable.dumpFullTrace(indent: String, qualifier: String) {

Response:
this.dumpSelfTrace(indent, qualifier) || return

        var cause = this.cause
        while (cause != null) {
            cause.dumpSelfTrace(indent, "Caused by: ") || return
            cause = cause.cause
        }
    }

    private fun Throwable.dumpSelfTrace(indent: String, qualifier: String): Boolean {<|endoftext|>


Prompt:
val companion = jvmStaticFunction.parentAsClass
            assert(companion.isCompanion)
            if (jvmStaticFunction.isExternal) {
                // We move external functions to the enclosing class and potentially add accessors there.
                // The JVM backend also adds accessors in the companion object, but these are superfluous.
                val staticExternal = context.irFactory.buildFun {

Response:
updateFrom(jvmStaticFunction)
                    name = jvmStaticFunction.name
                    returnType = jvmStaticFunction.returnType
                }.apply {
                    parent = companion.parent
                    copyAttributes(jvmStaticFunction)
                    copyAnnotationsFrom(jvmStaticFunction)
                    copyCorrespondingPropertyFrom(jvmStaticFunction)
                    copyParameterDeclarationsFrom(jvmStaticFunction)<|endoftext|>


Prompt:
// TARGET_BACKEND: JVM_IR

// WITH_STDLIB
// !LANGUAGE: +InstantiationOfAnnotationClasses

fun f(): Metadata = Metadata(
    kind = 0,
    metadataVersion = intArrayOf(),
    data1 = arrayOf(),
    data2 = arrayOf(),
    extraString = "",
    packageName = "foo",
    extraInt = 0,

Response:
bytecodeVersion = intArrayOf(1, 0, 3),
)

fun box(): String {
    val m = f()
    if (m.toString() == """@kotlin.Metadata(bytecodeVersion=[1, 0, 3], data1=[], data2=[], extraInt=0, extraString=, kind=0, metadataVersion=[], packageName=foo)""")
        return "OK"<|endoftext|>


Prompt:
inline fun buildCodeFragment(init: FirCodeFragmentBuilder.() -> Unit): FirCodeFragment {
    contract {
        callsInPlace(init, InvocationKind.EXACTLY_ONCE)
    }
    return FirCodeFragmentBuilder().apply(init).build()
}

@OptIn(ExperimentalContracts::class)

Response:
inline fun buildCodeFragmentCopy(original: FirCodeFragment, init: FirCodeFragmentBuilder.() -> Unit): FirCodeFragment {
    contract {
        callsInPlace(init, InvocationKind.EXACTLY_ONCE)
    }
    val copyBuilder = FirCodeFragmentBuilder()
    copyBuilder.source = original.source
    copyBuilder.resolvePhase = original.resolvePhase<|endoftext|>


Prompt:
val VALUE_ARGUMENTS_LIST: PositioningStrategy<KtElement> = object : PositioningStrategy<KtElement>() {
        override fun mark(element: KtElement): List<TextRange> {
            return markElement(element.getChildOfType<KtValueArgumentList>() ?: element)
        }
    }

    @JvmField

Response:
val FUNCTION_PARAMETERS: PositioningStrategy<KtFunction> = object : PositioningStrategy<KtFunction>() {
        override fun mark(element: KtFunction): List<TextRange> {
            val valueParameterList = element.valueParameterList
            if (valueParameterList != null) {
                return markElement(valueParameterList)
            }<|endoftext|>


Prompt:
return Lateinit<R>().apply(builder).value
}

val p = false

fun test1() {
    var y: String? = null
    val x: String = run {
        if (p)
            return@run build { y as String; value = "..." }
        else
            return@run ""
    }
    y<!UNSAFE_CALL!>.<!>length // bad

Response:
}

fun test2() {
    val x: String = run {
        while (true) {
            try {
                return@run build { value = "..." }
            } catch (e: Throwable) {}
        }
        throw Exception()
    }
    x.length
}

fun test3() {
    var y: String?
    y = ""
    val x: String = run {<|endoftext|>


Prompt:
// WITH_STDLIB

import kotlin.experimental.ExperimentalTypeInference
object Hello {
    val hello = "hello"
}

@OptIn(ExperimentalTypeInference::class)
fun <E> buildList0(builder: MutableList<E>.() -> Unit): List<E> = mutableListOf<E>().apply { builder() }

val numbers = buildList0 {

Response:
add(Hello.let { it::hello }.get())
}

fun box(): String {
    numbers
    return "OK"
}<|endoftext|>


Prompt:
override var v : Module = m
}

abstract class SettingComponent<V: Any>(
    val reference: Reference<V>
) {
    var value: V
        get() = reference.v
        set(value) {
            reference.v = value
        }
}

class Component(
    reference: Reference<Module>,
    context: Context
) : SettingComponent<Module>(reference) {

Response:
private val model = Model(::value, context)
}<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.symbols.impl.FirValueParameterSymbol
import org.jetbrains.kotlin.fir.types.varargElementType
import org.jetbrains.kotlin.name.Name

internal class KtFirValueParameterSymbol(
    override val firSymbol: FirValueParameterSymbol,

Response:
override val analysisSession: KtFirAnalysisSession,
) : KtValueParameterSymbol(), KtFirSymbol<FirValueParameterSymbol> {
    override val psi: PsiElement? by cached { firSymbol.findPsi() }

    override val name: Name get() = withValidityAssertion { firSymbol.name }<|endoftext|>


Prompt:
withValidityAssertion { analysisSession.typeProvider.getImplicitReceiverTypesAtPosition(position) }

    /**
     * Gets the direct super types of the given type. For example, given `MutableList<String>`, this returns `List<String>` and
     * `MutableCollection<String>`.
     *

Response:
* Note that for flexible types, both direct super types of the upper and lower bounds are returned. If that's not desirable, please
     * first call [KtFlexibleType.upperBound] or [KtFlexibleType.lowerBound] and then call this method.
     *
     * @param shouldApproximate whether to approximate non-denotable types. For example, super type of `List<out String>` is<|endoftext|>


Prompt:
)
                                    }

                                else ->
                                    +writeParcelWith(
                                        declaration.classParceler,
                                        parcelParameter,
                                        flagsParameter,
                                        irGet(receiverParameter)
                                    )
                            }
                        }
                    }
                }

                metadata = DescriptorMetadataSource.Function(

Response:
declaration.descriptor.findFunction(ParcelableSyntheticComponent.ComponentKind.WRITE_TO_PARCEL)!!
                )
            }

            declaration.functions.find {
                (it.descriptor as? ParcelableSyntheticComponent)?.componentKind == ParcelableSyntheticComponent.ComponentKind.WRITE_TO_PARCEL
            }?.let { stub -><|endoftext|>


Prompt: s.<!DEBUG_INFO_CALL("fqName: libPackage.funWithTrailingLambda; typeCall: extension function")!>funWithTrailingLambda { "ss" }<!>

Response: s.<!DEBUG_INFO_CALL("fqName: libPackage.funWithTrailingLambda; typeCall: extension function")!>funWithTrailingLambda (x= 1) { "ss" }<!><|endoftext|>


Prompt:
map.put(FUNCTION_DECLARATION_WITH_NO_NAME, "Function declaration must have a name.")
        map.put(ANONYMOUS_FUNCTION_WITH_NAME, "Anonymous functions with names are prohibited.")
        map.put(SINGLE_ANONYMOUS_FUNCTION_WITH_NAME, "Anonymous functions with names are prohibited.")

        map.put(

Response:
ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE,
            "Anonymous functions cannot specify default values for their parameters."
        )
        map.put(USELESS_VARARG_ON_PARAMETER, "Vararg on this parameter is useless.")
        map.put(<|endoftext|>


Prompt:
fun less4(a: Double?, b: Double?) = if (a is Double && b is Double) a < b else null!!

fun less5(a: Any?, b: Any?) = if (a is Double && b is Double) a < b else null!!

fun box(): String {
    if (-0.0 < 0.0) return "fail 0"

Response:
if (less1(-0.0, 0.0)) return "fail 1"
    if (less2(-0.0, 0.0)) return "fail 2"
    if (less3(-0.0, 0.0)) return "fail 3"
    if (less4(-0.0, 0.0)) return "fail 4"<|endoftext|>


Prompt:
fun shouldEraseType(type: ConeTypeParameterType): Boolean = containingFirClassStack.asReversed().any { clazz ->
        if (clazz !is FirAnonymousObject && !clazz.isLocal) return@any false

        val typeParameterSymbol = type.lookupTag.typeParameterSymbol

Response:
if (typeParameterSymbol.containingDeclarationSymbol.fir.let { it !is FirProperty || it.delegate == null || !it.isExtension }) {
            return@any false
        }

        return@any clazz.typeParameters.any { it.symbol === typeParameterSymbol }
    }
}<|endoftext|>


Prompt:
getSymbolsFromImportingScope(importScopeContext, fqName, KtScopeKind.ExplicitSimpleImportingScope::class).ifNotEmpty { return this }
        getSymbolsFromPackageScope(fqName, contextElement).ifNotEmpty { return this }

Response:
getSymbolsFromImportingScope(importScopeContext, fqName, KtScopeKind.DefaultSimpleImportingScope::class).ifNotEmpty { return this }
        getSymbolsFromImportingScope(importScopeContext, fqName, KtScopeKind.ExplicitStarImportingScope::class).ifNotEmpty { return this }<|endoftext|>


Prompt:
* It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.
 *
 * @param destination the array to copy to.
 * @param destinationOffset the position in the [destination] array to copy to, 0 by default.
 * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.

Response:
* @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.<|endoftext|>


Prompt:
it.resolvedStatus.isConst && it.isMarkedWithImplicitIntegerCoercion
                } == true
            ) {
                IrCallImpl(
                    startOffset, endOffset,
                    firConversionFunction.fir.returnTypeRef.toIrType(),
                    irConversionFunction,
                    typeArgumentsCount = 0,
                    valueArgumentsCount = 0
                ).apply {

Response:
extensionReceiver = this@applyToElement
                }
            } else {
                this@applyToElement
            }
        }

        return when {
            parameter.isMarkedWithImplicitIntegerCoercion -> when {
                this is IrVarargImpl && argument is FirVarargArgumentsExpression -> {
                    val targetTypeFqName = varargElementType.classFqName ?: return this<|endoftext|>