Prompt:
get() = byValue(this.reinterpret<IntVar>().value)
            set(value) { this.reinterpret<IntVar>().value = value.value }
    }
}

enum class CXCursorKind(value: Int) : CEnum {
    CXCursor_UnexposedDecl(1),
    CXCursor_StructDecl(2),

Response:
CXCursor_UnionDecl(3),
    CXCursor_ClassDecl(4),
    CXCursor_EnumDecl(5),
    CXCursor_FieldDecl(6),
    CXCursor_EnumConstantDecl(7),
    CXCursor_FunctionDecl(8),
    CXCursor_VarDecl(9),<|endoftext|>


Prompt:
public inline fun <R : kotlin.Comparable<R>> kotlin.CharArray.minBy(selector: (kotlin.Char) -> R): kotlin.Char

@kotlin.SinceKotlin(version = "1.7")
@kotlin.jvm.JvmName(name = "minByOrThrow")

Response:
public inline fun <R : kotlin.Comparable<R>> kotlin.DoubleArray.minBy(selector: (kotlin.Double) -> R): kotlin.Double

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


Prompt:
"java.util.Arrays.fill(this, fromIndex, toIndex, element)"
                }
            }
            on(Platform.JS) {
                suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
                since("1.3")
                body {
                    """
                    AbstractList.checkRangeIndexes(fromIndex, toIndex, size)

Response:
nativeFill(element, fromIndex, toIndex)
                    """
                }
                specialFor(ArraysOfPrimitives) {
                    if (primitive == PrimitiveType.Char) {
                        body {
                            """
                            AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
                            // We need to call [Char.code] here to eliminate Char-boxing with the new JS function inlining logic<|endoftext|>


Prompt:
}

            else ->
                super.visitTypeOperator(expression)
        }

    override fun visitVararg(expression: IrVararg): IrExpression =
        expression.transformPostfix {
            elements.forEachIndexed { i, element ->
                when (element) {
                    is IrSpreadElement ->
                        element.expression = element.expression.cast(expression.type)

Response:
is IrExpression ->
                        putElement(i, element.cast(varargElementType))
                }
            }
        }

    private fun IrExpressionBody.coerceInnerExpression(expectedType: KotlinType) {
        expression = expression.cast(expectedType)
    }

    private fun IrExpression.cast(irType: IrType): IrExpression =<|endoftext|>


Prompt:
) {
                    reportJvmSignatureClash(
                        diagnosticReporter,
                        JvmBackendErrors.CONFLICTING_JVM_DECLARATIONS,
                        declarations,
                        conflictingJvmDeclarationsData
                    )
                }
            }

            else ->

Response:
if (classCodegen.irClass.origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS) {
                    reportJvmSignatureClash(
                        diagnosticReporter,
                        JvmBackendErrors.ACCIDENTAL_OVERRIDE,
                        declarations.filter { !it.isFakeOverride && !it.isSpecialOverride() },
                        conflictingJvmDeclarationsData
                    )
                }<|endoftext|>


Prompt:
if (AnalysisApiTestDirectives.MODULE_KIND !in moduleStructure.allDirectives) return moduleStructure

        val moduleMapping = moduleStructure.modules.associateBy(TestModule::name)
        return TestModuleStructureImpl(
            moduleStructure.modules.map { module ->
                module.copy(
                    allDependencies = module.allDependencies.map { dependency ->

Response:
transformDependency(dependency, moduleMapping)
                    }
                )
            },
            moduleStructure.originalTestDataFiles,
        )
    }

    private fun transformDependency(
        dependency: DependencyDescription,
        moduleMapping: Map<String, TestModule>,
    ): DependencyDescription {
        val dependencyModule = moduleMapping.getValue(dependency.moduleName)<|endoftext|>


Prompt:
// generic signature: null

// method: Test::withReferenceAsNullable-nB_snAY
// jvm signature: (Ljava/lang/String;)V
// generic signature: null

// method: Test::withNullablePrimitiveAsNullable-v_QJOCg
// jvm signature: (LInlineNullablePrimitive;)V
// generic signature: null

Response:
// method: Test::withNullableReferenceAsNullable-jLXMqSo
// jvm signature: (LInlineNullableReference;)V
// generic signature: null<|endoftext|>


Prompt:
return "OK"
}

// CHECK_BYTECODE_TEXT
// JVM_IR_TEMPLATES
// 1 INVOKEVIRTUAL java/lang/StringBuilder\.append \(Z\)Ljava/lang/StringBuilder;
// 3 INVOKEVIRTUAL java/lang/StringBuilder\.append \(I\)Ljava/lang/StringBuilder;

Response:
// 1 INVOKEVIRTUAL java/lang/StringBuilder\.append \(J\)Ljava/lang/StringBuilder;
// 1 INVOKEVIRTUAL java/lang/StringBuilder\.append \(F\)Ljava/lang/StringBuilder;
// 1 INVOKEVIRTUAL java/lang/StringBuilder\.append \(D\)Ljava/lang/StringBuilder;<|endoftext|>


Prompt:
inline fun ordinaryInlineAcceptsVCString_Null(i: Int, vc: VCString?) {
    result = vc
}

inline fun ordinaryInlineAcceptsVCStringNullable_Null(i: Int, vc: VCStringNullable?) {
    result = vc
}

inline fun ordinaryInlineAcceptsVCAny_Null(i: Int, vc: VCAny?) {

Response:
result = vc
}

inline fun ordinaryInlineAcceptsVCAnyNullable_Null(i: Int, vc: VCAnyNullable?) {
    result = vc
}

inline fun ordinaryInlineAcceptsVCInt_Null(i: Int, vc: VCInt?) {
    result = vc
}<|endoftext|>


Prompt:
A(1).foo(null)

    val k2: Int = B(1).component1()
    B(1).foo(1)
    B(1).foo(null)

    val k3: Int = C(1).component1()
    C(1).foo(1)
    C(1).foo(null)

    val k4: Int = D(1).component1()

Response:
D(1).foo(1)
}<|endoftext|>


Prompt:
private val SHORT_RANGE = Short.MIN_VALUE.toLong()..Short.MAX_VALUE.toLong()

        private val UBYTE_RANGE = UByte.MIN_VALUE.toLong()..UByte.MAX_VALUE.toLong()
        private val USHORT_RANGE = UShort.MIN_VALUE.toLong()..UShort.MAX_VALUE.toLong()

Response:
private val UINT_RANGE = UInt.MIN_VALUE.toLong()..UInt.MAX_VALUE.toLong()
    }
}

class ConeIntegerConstantOperatorTypeImpl(
    isUnsigned: Boolean,
    nullability: ConeNullability
) : ConeIntegerConstantOperatorType(isUnsigned, nullability) {<|endoftext|>


Prompt:
for (element in this) if (predicate(element)) return element
    return null
}

/**
 * Returns the first element matching the given [predicate], or `null` if element was not found.
 */
public inline fun ByteArray.firstOrNull(predicate: (Byte) -> Boolean): Byte? {
    for (element in this) if (predicate(element)) return element
    return null
}

/**

Response:
* Returns the first element matching the given [predicate], or `null` if element was not found.
 */
public inline fun ShortArray.firstOrNull(predicate: (Short) -> Boolean): Short? {
    for (element in this) if (predicate(element)) return element
    return null
}

/**
 * Returns the first element matching the given [predicate], or `null` if element was not found.
 */<|endoftext|>


Prompt:
if (x == z == true && <!SENSELESS_COMPARISON!>x === z<!> || (c != z && !c)) {

        } else {
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.equals(null)
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.propT<|endoftext|>


Prompt:
If updated IDL contains multiple union arguments and this check fails,
                consider updating the algorithm or return listOf(op) as a fallback.
                """
            )

        val unionTypedArgumentIndex = op.arguments.indexOfFirst { it.type is IDLUnionTypeDeclaration }
        val unionTypedArgument = op.arguments[unionTypedArgumentIndex]

Response:
val unionType = unionTypedArgument.type as IDLUnionTypeDeclaration

        var unionMembersFlattened = unionType.unionMembers
        while (unionMembersFlattened.any { it is IDLUnionTypeDeclaration }) {
            unionMembersFlattened = unionMembersFlattened.flatMap {
                if (it is IDLUnionTypeDeclaration) it.unionMembers else listOf(it)
            }<|endoftext|>


Prompt:
<!DEBUG_INFO_CONSTANT_VALUE("\"a\"")!>val prop10: Any = "a"<!>

// val prop11: null
<!DEBUG_INFO_CONSTANT_VALUE("null")!>val prop11: <!UNRESOLVED_REFERENCE!>aaa<!> = 1<!>

// val prop14: null

Response:
<!DEBUG_INFO_CONSTANT_VALUE("null")!>val prop14: <!UNRESOLVED_REFERENCE!>aaa<!>? = 1<!>

class A

// val prop15: null<|endoftext|>


Prompt:
val AMBIGUOUS_FUNCTION_TYPE_KIND: KtDiagnosticFactory1<Collection<FunctionTypeKind>> by error1<PsiElement, Collection<FunctionTypeKind>>()

    // Context receivers resolution

Response: val NO_CONTEXT_RECEIVER: KtDiagnosticFactory1<ConeKotlinType> by error1<KtElement, ConeKotlinType>(SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED)<|endoftext|>


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

fun poll21(flag: Boolean) {
    val inv = when (flag) { true -> ::bar2 else -> ::foo2 }
    inv()
}

fun poll22(flag: Boolean) {

Response: val inv = when (flag) { true -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>bar3<!><!> else -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>foo3<!><!> }<|endoftext|>


Prompt:
<!CONFLICTING_OVERLOADS!>private fun invalidFun1()<!> {}
<!CONFLICTING_OVERLOADS!>private fun invalidFun1()<!> {}

<!CONFLICTING_OVERLOADS!>private fun invalidFun2()<!> {}
<!CONFLICTING_OVERLOADS!>public fun invalidFun2()<!> {}

Response:
<!CONFLICTING_OVERLOADS!>public fun invalidFun3()<!> {}

<!CONFLICTING_OVERLOADS!>private fun invalidFun4()<!> {}
<!CONFLICTING_OVERLOADS!>public fun invalidFun4()<!> {}

public fun validFun2(a: A) = a
public fun validFun2(b: B) = b<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("Out<kotlin.Int?> & Out<kotlin.Int?>?")!>x<!>.funNullableAny()
        val y = <!DEBUG_INFO_SMARTCAST!>x<!>.get()
        if (y != null) {

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>y<!>
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?"), DEBUG_INFO_SMARTCAST!>y<!>.equals(null)<|endoftext|>


Prompt:
public inline fun DoubleArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Double): Double {
    contract {
        callsInPlace(defaultValue, InvocationKind.AT_MOST_ONCE)
    }
    return if (index in indices) get(index) else defaultValue(index)
}

/**

Response:
* Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.
 *
 * @sample samples.collections.Collections.Elements.elementAtOrElse
 */
@kotlin.internal.InlineOnly
public inline fun BooleanArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Boolean): Boolean {<|endoftext|>


Prompt:
branchName: String? = null,
        commitName: String? = null,
        tagName: String? = null,
    ): String {
        val branch = if (branchName != null) "branch = \"$branchName\"" else ""
        val commit = if (commitName != null) "commit = \"$commitName\"" else ""

Response:
val tag = if (tagName != null) "tag = \"$tagName\"" else ""
        return """source = git("$repo") {
                      |    $branch
                      |    $commit
                      |    $tag
                      |}
                    """.trimMargin()
    }

    private fun isRepoAvailable(repos: List<String>) = runBlocking {<|endoftext|>


Prompt:
fun test() {
    takeFun<String>(::foo)
    takeFun<String>(::<!INAPPLICABLE_CANDIDATE!>fooInt<!>)

    callFun<String, Wrapper<String>>(::createWrapper)
    callFun<Int, Wrapper<Number>>(::createWrapper)
    callFun<String, Wrapper<*>>(::createWrapper)

Response:
callFun<String, Wrapper<Int>>(::createWrapper)

    callFun<Int, Wrapper<Int>>(::createWrapper).baz(::foo)
}<|endoftext|>


Prompt:
class DebugInfoDiagnosticFactory1 : DiagnosticFactory1<PsiElement, String>,
    DebugInfoDiagnosticFactory {
    private val privateName: String

    override val name: String
        get() = "DEBUG_INFO_$privateName"

    override val withExplicitDefinitionOnly: Boolean

    override fun createDiagnostic(
        element: KtElement,

Response:
bindingContext: BindingContext,
        dataFlowValueFactory: DataFlowValueFactory?,
        languageVersionSettings: LanguageVersionSettings?,
        moduleDescriptor: ModuleDescriptorImpl?
    ) = when (privateName) {
        EXPRESSION_TYPE.privateName -> {
            val (type, dataFlowTypes) = CheckerTestUtil.getTypeInfo(
                element,
                bindingContext,<|endoftext|>


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

import org.jetbrains.kotlin.fir.FirElementWithResolveState
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
import org.jetbrains.kotlin.fir.declarations.ResolveStateAccess

Response:
import org.jetbrains.kotlin.fir.utils.exceptions.withFirEntry
import org.jetbrains.kotlin.utils.exceptions.checkWithAttachment

internal fun FirElementWithResolveState.checkPhase(requiredResolvePhase: FirResolvePhase) {
    @OptIn(ResolveStateAccess::class)
    val declarationResolveState = resolveState
    checkWithAttachment(<|endoftext|>


Prompt:
get() = compilation.languageSettings

    @Suppress("DeprecatedCallableAddReplaceWith")
    @get:Deprecated("Replaced with 'compilerOptions.progressiveMode'")
    @get:Internal
    val progressiveMode: Boolean
        get() = compilation.compilerOptions.options.progressiveMode.get()
    // endregion.

    @get:Input

Response:
val kotlinNativeVersion: String = project.konanVersion

    @get:Input
    val artifactVersion = project.version.toString()

    @get:Input
    internal val useEmbeddableCompilerJar: Boolean = project.nativeUseEmbeddableCompilerJar

    @get:Internal
    open val outputFile: Provider<File>
        get() = destinationDirectory.flatMap {<|endoftext|>


Prompt:
return itemIterator!!.next()
        }

        override fun hasNext(): Boolean {
            if (state == State.READY) return true
            if (state == State.DONE) return false
            return ensureItemIterator()
        }

        private fun ensureItemIterator(): Boolean {
            val itemIterator = itemIterator
            if (itemIterator != null && itemIterator.hasNext()) {

Response:
state = State.READY
                return true
            }

            while (iterator.hasNext()) {
                val element = iterator.next()
                val nextItemIterator = iterator(transformer(element))
                if (nextItemIterator.hasNext()) {
                    this.itemIterator = nextItemIterator
                    state = State.READY
                    return true
                }
            }

            state = State.DONE<|endoftext|>


Prompt:
irFile.transform(InlineClassTransformer(context), data = null)
    }

}

private class AutoboxingTransformer(val context: Context) : AbstractValueUsageTransformer(
        context.ir.symbols,
        context.irBuiltIns
) {

    // TODO: should we handle the cases when expression type
    // is not equal to e.g. called function return type?

Response:
override fun IrExpression.useInTypeOperator(operator: IrTypeOperator, typeOperand: IrType): IrExpression {
        return if (operator == IrTypeOperator.IMPLICIT_COERCION_TO_UNIT ||
                   operator == IrTypeOperator.IMPLICIT_INTEGER_COERCION) {
            this
        } else {<|endoftext|>


Prompt: } get;                     <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var e22: Int<!>; set get;                       <!MUST_BE_INITIALIZED!>var e23: Int<!>; set(v) {} get;

Response: var c20: Int = 1; get;                                              var c21: Int = 1; set(v) { field = v } get;                                                          var c22: Int = 1; set get;                                             var c23: Int = 1; set(v) {} get;<|endoftext|>


Prompt:
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.*
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.LibraryCompilation
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.ObjCFrameworkCompilation

Response:
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.TestCompilationResult.Companion.assertSuccess
import org.jetbrains.kotlin.konan.test.blackbox.support.group.FirPipeline
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.CacheMode<|endoftext|>


Prompt:
lines().count {
                it.contains("final class") && it.endsWith("%KeyMeta {")
            }
        )
    }

    private fun String.assertFunctionKeyMetaClassAnnotationCount(expected: Int) {
        assertEquals(expected,
            lines().count {
                it.contains("@Landroidx/compose/runtime/internal/FunctionKeyMetaClass;")
            }

Response:
)
    }

    private fun String.assertFunctionKeyMetaAnnotationCount(expected: Int) {
        assertEquals(expected,
            lines().sumOf {
                when {
                    it.contains("@Landroidx/compose/runtime/internal/FunctionKeyMeta%Container;") -> {
                        it.occurrences("@Landroidx/compose/runtime/internal/FunctionKeyMeta;")<|endoftext|>


Prompt:
// mypack.Usage
package mypack

typealias UnitTypeAlias = Unit
typealias NullableUnitTypeAlias = Unit?

class Usage {
    fun unitTypeAlias(): UnitTypeAlias {

    }

    fun unitTypeAliasAsNullable(): UnitTypeAlias? = null

    fun nullableUnitTypeAlias(): NullableUnitTypeAlias = null

Response:
fun nullableUnitTypeAliasAsNullable(): NullableUnitTypeAlias? = null
}<|endoftext|>


Prompt:
name = "WrapInlineDeclarationsWithReifiedTypeParameters",
        description = "Wrap inline declarations with reified type parameters"
)

private val postInlinePhase = createFileLoweringPhase(
        { context: Context -> PostInlineLowering(context) },
        name = "PostInline",
        description = "Post-processing after inlining"
)

Response:
private val contractsDslRemovePhase = createFileLoweringPhase(
        { context: Context -> ContractsDslRemover(context) },
        name = "RemoveContractsDsl",
        description = "Contracts dsl removing"
)

// TODO make all lambda-related stuff work with IrFunctionExpression and drop this phase (see kotlin: dd3f8ecaacd)<|endoftext|>


Prompt:
annotation class A1
@Target(FILE)
annotation class C1(val value: Array<A1>)

<!REPEATABLE_CONTAINER_TARGET_SET_NOT_A_SUBSET_ERROR!>@R(C2::class)<!>
@Target(CLASS)
annotation class A2
@Target(CLASS, FUNCTION)

Response:
annotation class C2(val value: Array<A2>)

<!REPEATABLE_CONTAINER_TARGET_SET_NOT_A_SUBSET_ERROR!>@R(C3::class)<!>
@Target(TYPE)
annotation class A3
annotation class C3(val value: Array<A3>)<|endoftext|>


Prompt:
*failuresForEqualAndUnequalRight(
                "x",
                "y",
                "nx"
            ),
            *failuresForUnequalRight(x, "nn"),
            *failuresForUnequalRight("x", "nn"),
            *failuresForEqualAndUnequalRight(x, y, "ax"),
            *failuresForEqualAndUnequalRight(

Response:
"x",
                "y",
                "ax"
            ),
            *failuresForEqualAndUnequalRight(
                "bx",
                "by",
                "ax"
            ),
            *failuresForUnequalRight(x, "an"),
            *failuresForUnequalRight("x", "an"),
            *failuresForUnequalRight("bx", "an")<|endoftext|>


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

import org.gradle.api.attributes.Attribute
import org.gradle.api.internal.artifacts.ArtifactAttributes

internal class ArtifactTypeAttributeAccessorG6(
) : ArtifactTypeAttributeAccessor {
    override val artifactTypeAttribute: Attribute<String>
        get() = ArtifactAttributes.ARTIFACT_FORMAT

Response:
internal class ArtifactTypeAttributeAccessorVariantFactoryG6 :
        ArtifactTypeAttributeAccessor.ArtifactTypeAttributeAccessorVariantFactory {
        override fun getInstance(): ArtifactTypeAttributeAccessor = ArtifactTypeAttributeAccessorG6()
    }
}<|endoftext|>


Prompt:
@file:Suppress("NON_MEMBER_FUNCTION_NO_BODY", "UNUSED_PARAMETER", "unused")

package kotlin.js

@RequiresOptIn(message = "Here be dragons! This is a compiler intrinsic, proceed with care!")
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.FUNCTION)

Response:
internal annotation class JsIntrinsic

@JsIntrinsic
internal fun jsEqeq(a: Any?, b: Any?): Boolean

@JsIntrinsic
internal fun jsNotEq(a: Any?, b: Any?): Boolean

@JsIntrinsic
internal fun jsUndefined(): Nothing?

@JsIntrinsic<|endoftext|>


Prompt:
DslMarkerOnFunctionTypeReceiver(KOTLIN_1_4, kind = BUG_FIX),
    RestrictReturnStatementTarget(KOTLIN_1_4, kind = BUG_FIX),
    NoConstantValueAttributeForNonConstVals(KOTLIN_1_4, kind = BUG_FIX),
    WarningOnMainUnusedParameter(KOTLIN_1_4),

Response:
PolymorphicSignature(KOTLIN_1_4),
    ProhibitConcurrentHashMapContains(KOTLIN_1_4, kind = BUG_FIX),
    ProhibitTypeParametersForLocalVariables(KOTLIN_1_4, kind = BUG_FIX),
    ProhibitJvmOverloadsOnConstructorsOfAnnotationClasses(KOTLIN_1_4, kind = BUG_FIX),<|endoftext|>


Prompt:
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinarySourceElement

object FirJvmInlineTargetQualifiedAccessChecker : FirQualifiedAccessExpressionChecker(MppCheckerKind.Common) {
    override fun check(expression: FirQualifiedAccessExpression, context: CheckerContext, reporter: DiagnosticReporter) {

Response:
val callableSymbol = expression.calleeReference.toResolvedCallableSymbol() ?: return
        if (callableSymbol.origin.fromSource) return

        val isInline = when (callableSymbol) {
            is FirFunctionSymbol<*> -> callableSymbol.isInline
            is FirPropertySymbol -> {<|endoftext|>


Prompt:
compilerArguments.detectVersionAutoAdvance()

        if (useProjectSettings != null) {
            this.useProjectSettings = useProjectSettings
        } else {
            // Migration problem workaround for pre-1.1-beta releases (mainly 1.0.6) -> 1.1-rc+

Response:
// Problematic cases: 1.1-beta/1.1-beta2 -> 1.1-rc+ (useProjectSettings gets reset to false)
            // This heuristic detects old enough configurations:
            if (jvmArgumentsElement == null) {
                this.useProjectSettings = false
            }
        }

        this.compilerSettings = compilerSettings
        this.compilerArguments = compilerArguments<|endoftext|>


Prompt:
// ISSUE: KT-39034

interface A

fun test_0(a: A, f: A.() -> Unit) {
    a.f()
}

fun test_1(a: A, ys: List<A.() -> Unit>) {
    for (y in ys) {
        a.y()
    }
}

Response:
fun test_2(a: A, vararg zs: A.() -> Unit) {
    for (z in zs) {
        a.z()
    }
}<|endoftext|>


Prompt:
val candidateTrace = TemporaryBindingTrace.create(basicCallContext.trace, "Context for resolve candidate")
            val candidateCall = ResolvedCallImpl(
                basicCallContext.call, towerCandidate.descriptor,
                towerCandidate.dispatchReceiver?.receiverValue, extensionReceiver?.receiverValue,
                explicitReceiverKind, null, candidateTrace, tracing,

Response:
basicCallContext.dataFlowInfoForArguments // todo may be we should create new mutable info for arguments
            )

            /**
             * See https://jetbrains.quip.com/qcTDAFcgFLEM
             *
             * For now we have only 2 functions with dynamic receivers: iterator() and unsafeCast()<|endoftext|>


Prompt:
val bar get() = "Failed"
}

interface IFooBar2 : IFooBar

OPTIONAL_JVM_INLINE_ANNOTATION
value class Test1<T: String>(val k: T): IFooBar {
    override val bar: String
        get() = k
}

OPTIONAL_JVM_INLINE_ANNOTATION

Response:
value class Test2<T: String>(val k: T): IFooBar2 {
    override val bar: String
        get() = k
}

fun box(): String {
    val k = Test1("K")
    val ik: IFooBar = k
    val k2 = Test2("K")
    val ik2: IFooBar = k2<|endoftext|>


Prompt:
/*p:bar p:foo p:java.lang p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.comparisons p:kotlin.io p:kotlin.jvm p:kotlin.ranges p:kotlin.sequences p:kotlin.text*/E./*p:foo.E*/valueOf("")
}

Response:
/*p:foo*/fun classifiers(
        a: /*p:foo*/A,
        ab: /*p:foo*/A./*p:foo.A*/B,
        ac: /*p:foo*/A./*p:foo.A*/C,
        abCo: /*p:foo*/A./*p:foo.A*/B./*p:foo.A.B*/CO,<|endoftext|>


Prompt:
val byteBuffer = byteBufferForEncoding(chunkSize, encoder)

    var startIndex = 0
    var leftover = 0

    while (startIndex < text.length) {
        val copyLength = minOf(chunkSize - leftover, text.length - startIndex)
        val endIndex = startIndex + copyLength

Response:
text.toCharArray(charBuffer.array(), leftover, startIndex, endIndex)
        charBuffer.limit(copyLength + leftover)
        encoder.encode(charBuffer, byteBuffer, /*endOfInput = */endIndex == text.length).also { check(it.isUnderflow) }
        this.write(byteBuffer.array(), 0, byteBuffer.position())<|endoftext|>


Prompt:
instructions.insertBefore(insnNode, jumpInsnNode)
                        instructions.remove(insnNode)
                        insnNode = jumpInsnNode
                    }

                    val label = LabelNode()
                    instructions.insert(insnNode, label)
                    // generate finally blocks before the non-local return flag or the stack fixup pseudo instruction

Response:
val finallyInsertionPoint = if (isLocalReturn && jumpTarget == endLabel) insnNode else insnNode.previous
                    result.add(PointForExternalFinallyBlocks(finallyInsertionPoint, returnType, label, jumpTarget))
                }
                insnNode = insnNode.next
            }
            return result
        }
    }

    private fun isRegeneratingAnonymousObject(): Boolean =<|endoftext|>


Prompt:
target.compilations.getByName("test").cinterops.create("appleTestHelper").identifier
        }

        iosTargets.map { target ->
            target.compilations.getByName("main").cinterops.create("iosHelper").identifier
        }

        iosX64.compilations.getByName("main").cinterops.create("iosX64Helper").identifier

Response:
iosX64.compilations.getByName("test").cinterops.create("iosX64TestHelper").identifier

        /* Define source set hierarchy */
        val commonMain = kotlin.sourceSets.getByName("commonMain")
        val commonTest = kotlin.sourceSets.getByName("commonTest")<|endoftext|>


Prompt:
println(prepend + """
                |stdout:
                |$stdOut
                |stderr:
                |$stdErr
                |exit code: $exitCode
                """.trimMargin())
    }
}

/**
 * Create a test task of the given type. Supports configuration with Closure passed form build.gradle file.
 */

Response:
fun <T : KonanTestExecutable> Project.createTest(name: String, type: Class<T>, config: Closure<*>): T =
        project.tasks.create(name, type).apply {
            // Apply closure set in build.gradle to get all parameters.
            this.configure(config)
            if (enabled) {<|endoftext|>


Prompt:
override fun lower(irFile: IrFile) {
        irFile.transformChildrenVoid(this)
    }

    private val irBuiltIns = context.irBuiltIns
    private val symbols = context.ir.symbols

    private val typesWithSpecialAppendFunction = irBuiltIns.primitiveIrTypes + irBuiltIns.stringType

    private val nameAppend = Name.identifier("append")

Response:
private val stringBuilder = context.ir.symbols.stringBuilder.owner

    //TODO: calculate and pass string length to the constructor.
    private val constructor = stringBuilder.constructors.single {
        it.valueParameters.isEmpty()
    }

    private val defaultAppendFunction = stringBuilder.functions.single {
        it.name == nameAppend &&<|endoftext|>


Prompt:
buildList {
                files.forEach { ktFile ->
                    val firFile = firFileBuilder.buildRawFirFileWithCaching(ktFile)
                    firFile.collectCallableDeclarationsTo(this, callableId.callableName)
                }
            }
        }

    val symbolNameCache = FirCompositeCachedSymbolNamesProvider.create(
        firSession,

Response:
listOfNotNull(
            LLFirKotlinSymbolNamesProvider(declarationProvider, allowKotlinPackage),
            extensionTool?.symbolNamesProvider,
        )
    )

    fun getFirClassifierByFqNameAndDeclaration(
        classId: ClassId,
        classLikeDeclaration: KtClassLikeDeclaration?,
    ): FirClassLikeDeclaration? {<|endoftext|>


Prompt:
) : AnnotationDescriptor, LazyEntity, ValidateableDescriptor {

    override val type by c.storageManager.createLazyValue(
        computable = lazy@{
            val annotationType = c.annotationResolver.resolveAnnotationType(scope, annotationEntry, c.trace)
            if (annotationType is AbbreviatedType) {

Response:
// This is needed to prevent recursion in cases like this: typealias S = @S Ann
                if (annotationType.annotations.any { it == this }) {
                    annotationType.abbreviation.constructor.declarationDescriptor?.let { typeAliasDescriptor -><|endoftext|>


Prompt:
// 1 LOCALVARIABLE \$i\$a\$-inlineFun-DefaultLambdaKt\$inlineFun\$1 I
// inlineFun, inlineFun$default, inlined inlineFun:
// 3 LOCALVARIABLE \$i\$f\$inlineFun

// JVM_IR_TEMPLATES_WITH_INLINE_SCOPES

Response:
// 1 LOCALVARIABLE \$i\$a\$-inlineFun-DefaultLambdaKt\$inlineFun\$1\\2\\30\\0 I
// inlineFun, inlineFun$default, inlined inlineFun:
// 1 LOCALVARIABLE \$i\$f\$inlineFun\\1
// 2 LOCALVARIABLE \$i\$f\$inlineFun I<|endoftext|>


Prompt:
package org.jetbrains.kotlin.ir.interpreter.transformer

import com.intellij.openapi.progress.ProcessCanceledException
import org.jetbrains.kotlin.constant.ErrorValue
import org.jetbrains.kotlin.constant.EvaluatedConstTracker
import org.jetbrains.kotlin.incremental.components.InlineConstTracker

Response:
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
import org.jetbrains.kotlin.ir.interpreter.IrInterpreter<|endoftext|>


Prompt:
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)
    fooByte(<!ARGUMENT_TYPE_MISMATCH!>1 + 1<!>)
    fooLong(1 + 1)

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

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


Prompt:
}
}

fun generateBuiltIns(generate: (File, (PrintWriter) -> BuiltInsGenerator) -> Unit) {
    assertExists(BUILT_INS_NATIVE_DIR_JVM)
    assertExists(BUILT_INS_NATIVE_DIR_JS)
    assertExists(BUILT_INS_NATIVE_DIR_WASM)

Response:
assertExists(BUILT_INS_NATIVE_DIR_NATIVE)
    assertExists(BUILT_INS_SRC_DIR)
    assertExists(RUNTIME_JVM_DIR)
    assertExists(UNSIGNED_TYPES_DIR)<|endoftext|>


Prompt:
// EXPECTED_REACHABLE_NODES: 1238
// FILE: bar.kt
@file:JsQualifier("foo")
package foo

external interface Bar {
    fun ping(): String
}

// FILE: baz.kt
package boo

external interface Baz {
    fun pong(): Int
}

// FILE: root.kt
import foo.Bar
import boo.Baz

Response:
external val bar: Bar
external val baz: Baz

// FILE: test.kt
fun box(): String {
    if (bar.ping() != "ping" || baz.pong() != 194) return "Fail"

    return "OK"
}

// FILE: test.js

var bar = {
    ping() {
        return "ping"
    }
};

var baz = {<|endoftext|>


Prompt:
assertEquals("13, 21, 34, 55, 89, 144, 233, 377, 610, 987, ...", fibonacci().drop(7).joinToString(limit = 10))
        assertEquals("13, 21, 34, 55, 89, 144, 233, 377, 610, 987, ...", fibonacci().drop(3).drop(4).joinToString(limit = 10))

Response:
assertFailsWith<IllegalArgumentException> { fibonacci().drop(-1) }

        val dropMax = fibonacci().drop(Int.MAX_VALUE)
        run @Suppress("UNUSED_VARIABLE") {
            val dropMore = dropMax.drop(Int.MAX_VALUE)
            val takeMore = dropMax.take(Int.MAX_VALUE)
        }

    }<|endoftext|>


Prompt:
// If suspend function returns Unit and tail-call, it might appear, that it returns not Unit,
    // see comment above replaceReturnsUnitMarkersWithPushingUnitOnStack for explanation.
    // In this case, return Unit manually.
    @Suppress("UNCHECKED_CAST")
    if (returnType.classifier == Unit::class && !returnType.isMarkedNullable) return (Unit as R)
    return result

Response:
}

/**
 * Calls a callable in the current suspend context. If the callable is not a suspend function, behaves as [KCallable.callBy].
 * Otherwise, calls the suspend function with current continuation.
 */
@SinceKotlin("1.3")
suspend fun <R> KCallable<R>.callSuspendBy(args: Map<KParameter, Any?>): R {<|endoftext|>


Prompt:
private fun getCapturedFieldAccessChain(aload0: VarInsnNode): List<AbstractInsnNode> {
            val lambdaAccessChain = mutableListOf<AbstractInsnNode>(aload0).apply {
                addAll(InsnSequence(aload0.next, null).filter { it.isMeaningful }.takeWhile { insnNode ->

Response:
insnNode is FieldInsnNode && AsmUtil.CAPTURED_THIS_FIELD == insnNode.name
                }.toList())
            }

            return lambdaAccessChain.apply {
                last().getNextMeaningful().takeIf { insn -> insn is FieldInsnNode }?.also {
                    //captured field access
                        insn ->
                    add(insn)
                }<|endoftext|>


Prompt:
val zc1 = ZMutableCollection(mutableListOf(Z(1), Z(2), Z(3)))
    zc1.remove(Z(1))
    if (Z(1) in zc1) throw AssertionError("Z(1) in zc1")

Response:
val zc2 = Z2MutableCollection(mutableListOf(z2(1), z2(2), z2(3)))
    zc2.remove(z2(1))
    if (z2(1) in zc2) throw AssertionError("z2(1) in zc2")

    return "OK"
}<|endoftext|>


Prompt:
package kt35940

import kotlin.reflect.*

@OptIn(ExperimentalAssociatedObjects::class)
@AssociatedObjectKey
@Retention(AnnotationRetention.BINARY)
annotation class Associated(val kClass: KClass<*>)

private interface I1 {
    val s: String
}

private class I1Impl : I1 {

Response:
override val s = "zzz"
}

private class C(var i1: I1?)

private interface I2 {
    fun bar(c: C)
}

private object I2Impl : I2 {
    override fun bar(c: C) {
        c.i1 = I1Impl()
    }
}

@Associated(I2Impl::class)<|endoftext|>


Prompt:
assert128BitHash("a".repeat(15), 4649666081741216883UL, 11336931969441833971UL)
        assert128BitHash("a".repeat(16), 14694504640136803685UL, 15089679700857083186UL)

Response:
assert128BitHash("a".repeat(17), 12343703380141332181UL, 12834902385258119372UL)
        assert128BitHash("a".repeat(20), 7859379477173421491UL, 12195612906319506123UL)<|endoftext|>


Prompt:
}

    // KotlinConstraintSystemCompleter.Context, PostponedArgumentsAnalyzer.Context
    override fun canBeProper(type: KotlinTypeMarker): Boolean {
        checkState(State.BUILDING, State.COMPLETION)
        return !type.contains { storage.notFixedTypeVariables.containsKey(it.typeConstructor()) }
    }

Response:
override fun containsOnlyFixedOrPostponedVariables(type: KotlinTypeMarker): Boolean {
        checkState(State.BUILDING, State.COMPLETION)
        return !type.contains {
            val typeConstructor = it.typeConstructor()
            val variable = storage.notFixedTypeVariables[typeConstructor]?.typeVariable<|endoftext|>


Prompt:
is <!INCOMPATIBLE_TYPES!>String<!> -> 1
      <!USELESS_IS_CHECK!>!is Int<!> -> 1
      <!USELESS_IS_CHECK!>is Any<!USELESS_NULLABLE_CHECK!>?<!><!> -> 1
      <!USELESS_IS_CHECK!>is Any<!> -> 1

Response:
<!INCOMPATIBLE_TYPES!>s<!> -> 1
      1 -> 1
      1 + <!UNRESOLVED_REFERENCE!>a<!> -> 1
      in 1..<!UNRESOLVED_REFERENCE!>a<!> -> 1
      !in 1..<!UNRESOLVED_REFERENCE!>a<!> -> 1<|endoftext|>


Prompt:
.constructClassType(ConeTypeProjection.EMPTY_ARRAY, isNullable = false)
                    }
                    this.argumentMapping = buildAnnotationArgumentMapping {
                        mapping[StandardNames.NAME] =
                            buildLiteralExpression(null, ConstantValueKind.String, paramName, setType = true)
                    }
                }
            }
        }

Response:
return type(typeReference, annotations.computeTypeAttributes(moduleData.session, shouldExpandTypeAliases = false))
    }

    fun type(type: KotlinTypeBean): ConeKotlinType? {
        when (type) {
            is KotlinTypeParameterTypeBean -> {
                val lookupTag =<|endoftext|>


Prompt: const val concat5 = <!EVALUATED: `String concatenation example with A class: toString call from A class`!>"String concatenation example with A class: ${A()}"<!>

Response: const val concat6 = <!EVALUATED: `String concatenation example with B class, where toString is FAKE_OVERRIDDEN: toString call from A class`!>"String concatenation example with B class, where toString is FAKE_OVERRIDDEN: ${B()}"<!><|endoftext|>


Prompt:
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun rangeTo(o: Int) {}
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun rangeTo(o: Int, o2: Int) {}
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun rangeTo(vararg o: String) {}

Response: <!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun component1(): Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!><|endoftext|>


Prompt:
override val frontendToBackendConverter: Constructor<Frontend2BackendConverter<ClassicFrontendOutputArtifact, ClassicBackendInput>>
        get() = ::ClassicFrontend2ClassicBackendConverter

    override val backendFacade: Constructor<BackendFacade<ClassicBackendInput, BinaryArtifacts.Jvm>>
        get() = ::ClassicJvmBackendFacade
}

Response:
open class AbstractIrCompileKotlinAgainstInlineKotlinTest(targetBackend: TargetBackend = TargetBackend.JVM_IR) :
    AbstractCompileKotlinAgainstInlineKotlinTestBase<ClassicFrontendOutputArtifact, IrBackendInput>(
        FrontendKinds.ClassicFrontend,
        targetBackend
    ) {<|endoftext|>


Prompt:
}

// TESTCASE NUMBER: 8
fun case_8_1() {}
fun case_8(x: Any?) {
    if (x is String) {
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.String")!>x<!>
        val m = try {
            ::case_8_1
        } catch (e: Exception) {

Response:
::case_8_1
        }
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.String")!>x<!>
        val z: String = x
    }
}

// TESTCASE NUMBER: 9
fun case_9(x: Any?) {
    if (x is String) {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
import java.nio.file.Path

/**
 * Represents a module inside a project.
 *
 * [KtModule] is a Source Set (or considering a new project model naming a Fragment).

Response:
* Some examples of a module: main source set, test source set, library, JDK.
 *
 */
public sealed interface KtModule {
    /**
     * A list of Regular dependencies. Regular dependency allows the current module to see symbols from the dependent module. In the case
     * of a source set, it can be either the source set it depends on, a library, or an SDK.
     *<|endoftext|>


Prompt:
fun clang_Type_getAlignOf(T: CValue<CXType>): Long {
    memScoped {
        return kniBridge178(T.getPointer(memScope).rawValue)
    }
}

fun clang_Type_getClassType(T: CValue<CXType>): CValue<CXType> {
    memScoped {

Response:
val kniRetVal = nativeHeap.alloc<CXType>()
        try {
            kniBridge179(T.getPointer(memScope).rawValue, kniRetVal.rawPtr)
            return kniRetVal.readValue()
        } finally { nativeHeap.free(kniRetVal) }
    }
}<|endoftext|>


Prompt:
override fun isPropertyAccessor(): Boolean = function is FirPropertyAccessor

    override fun hasObjCMethodAnnotation(): Boolean = function.hasObjCMethodAnnotation(session)

    override fun hasObjCFactoryAnnotation(): Boolean = function.hasObjCFactoryAnnotation(session)

    override fun isObjCClassMethod(): Boolean = function.isObjCClassMethod(session)

Response:
override fun getValueParameterName(valueParameter: FirValueParameter): Name = valueParameter.name
}

class FirNativeKotlinMangleComputer(
        builder: StringBuilder,
        mode: MangleMode,
) : FirMangleComputer(builder, mode) {
    override fun copy(newMode: MangleMode): FirNativeKotlinMangleComputer =<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT

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

Response:
* MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver, call-with-an-explicit-type-receiver -> paragraph 3 -> sentence 2
 * NUMBER: 1
 * DESCRIPTION:
 */

/*
 * TESTCASE NUMBER: 1
 * UNEXPECTED BEHAVIOUR<|endoftext|>


Prompt:
if (local.metDefinitelyNotNullType) {
                builder.addVersionRequirement(writeVersionRequirement(LanguageFeature.DefinitelyNonNullableTypes))
            }
        }

        return builder
    }

    private fun constructorProto(descriptor: ConstructorDescriptor): ProtoBuf.Constructor.Builder {
        val builder = ProtoBuf.Constructor.newBuilder()

Response:
val local = createChildSerializer(descriptor)

        val flags = Flags.getConstructorFlags(
            hasAnnotations(descriptor), ProtoEnumFlags.descriptorVisibility(normalizeVisibility(descriptor)), !descriptor.isPrimary,
            shouldSerializeHasStableParameterNames(descriptor)
        )
        if (flags != builder.flags) {<|endoftext|>


Prompt:
private const val INDEX = "index\$$ATOMICFU"

class AtomicfuNativeIrTransformer(
    pluginContext: IrPluginContext,
    override val atomicSymbols: NativeAtomicSymbols
) : AbstractAtomicfuTransformer(pluginContext) {

    override val atomicPropertiesTransformer: AtomicPropertiesTransformer
        get() = NativeAtomicPropertiesTransformer()

Response:
override val atomicFunctionsTransformer: AtomicFunctionCallTransformer
        get() = NativeAtomicFunctionCallTransformer()

    private inner class NativeAtomicPropertiesTransformer : AtomicPropertiesTransformer() {

        override fun IrClass.addTransformedInClassAtomic(atomicProperty: IrProperty, index: Int): IrProperty =
            addVolatileProperty(atomicProperty, index)<|endoftext|>


Prompt:
when (functionVisitingState[definition.function]) {
                VisitedState.IN_PROCESS -> {
                    reportInlineCycle(call, definition.function)
                    return
                }
                VisitedState.PROCESSED -> return
                null -> {}
            }

            functionVisitingState[function] = VisitedState.IN_PROCESS

            withFunction(function, doProcess)

Response:
functionVisitingState[function] = VisitedState.PROCESSED

        } finally {
            if (!inlineCallInfos.isEmpty()) {
                @Suppress("DEPRECATION") // KT-65247
                if (inlineCallInfos.last.call == call) {
                    inlineCallInfos.removeLast()
                }
            }
        }
    }<|endoftext|>


Prompt:
private fun transformCall(methodContext: MethodContext, callContext: CallContext) {
        // Transform nested calls
        for (arg in callContext.args) {
            for (nestedCall in arg.calls) {
                transformCall(methodContext, nestedCall)
            }
        }
        for (call in callContext.calls) {
            transformCall(methodContext, call)
        }

Response:
if (callContext.args.any { it.isUnsafeToMove(methodContext) }) {
            // Do not transform such call, just strip call and argument markers.
            val insnList = methodContext.methodNode.instructions
            for (arg in callContext.args) {
                insnList.remove(arg.argStartMarker)
                insnList.remove(arg.argEndMarker)<|endoftext|>


Prompt:
// !JVM_DEFAULT_MODE: all-compatibility
// JVM_TARGET: 1.8

interface KInterface {

    var bar: String
        get() = "OK"
        set(field) {}
}

interface KInterface2 : KInterface {

}

// 1 INVOKESTATIC KInterface2.access\$getBar\$jd

Response:
// 1 INVOKESTATIC KInterface2.access\$setBar\$jd
// 1 INVOKESTATIC KInterface.access\$getBar\$jd
// 1 INVOKESTATIC KInterface.access\$setBar\$jd

// 1 INVOKESPECIAL KInterface2.getBar
// 1 INVOKESPECIAL KInterface2.setBar<|endoftext|>


Prompt:
// and does not take over the line number of whatever was generated before.
            tryInfo.onExit.firstChild().markLineNumber(true)
            // While keeping this value on the stack should be enough, the bytecode validator will
            // complain if a catch block does not start with ASTORE.
            val savedException = frameMap.enterTemp(AsmTypes.JAVA_THROWABLE_TYPE)

Response:
mv.store(savedException, AsmTypes.JAVA_THROWABLE_TYPE)

            val finallyStart = markNewLabel()
            val finallyGaps = tryInfo.gaps.toList()
            data.handleBlock { genFinallyBlock(tryInfo, null, null, data) }
            mv.load(savedException, AsmTypes.JAVA_THROWABLE_TYPE)<|endoftext|>


Prompt:
if (descriptor.kind != CallableMemberDescriptor.Kind.FAKE_OVERRIDE) return
            val containingClass = descriptor.containingDeclaration as? ClassDescriptor ?: return

            val possiblyClashingMembers = when (descriptor) {
                is PropertyAccessorDescriptor ->
                    containingClass.unsubstitutedMemberScope

Response:
.getContributedVariables(descriptor.correspondingProperty.name, NoLookupLocation.FROM_BACKEND)
                is PropertyDescriptor ->
                    containingClass.unsubstitutedMemberScope
                        .getContributedVariables(descriptor.name, NoLookupLocation.FROM_BACKEND)
                is FunctionDescriptor ->
                    containingClass.unsubstitutedMemberScope<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl

Response:
import org.jetbrains.kotlin.fir.types.impl.FirImplicitTypeRefImplWithoutSource
import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef
import org.jetbrains.kotlin.fir.utils.exceptions.withFirEntry
import org.jetbrains.kotlin.load.java.AnnotationQualifierApplicabilityType<|endoftext|>


Prompt:
val series: dynamic = object {}
        series["data"] = it.toTypedArray()
        classNames?.let { series["className"] = classNames[index] }
        series
    }.toTypedArray()
    return chartData
}

// Create object with options of chart.

Response:
fun getChartOptions(samples: Array<String>, yTitle: String, classNames: Array<String>? = null): dynamic {
    val chartOptions: dynamic = object {}
    chartOptions["fullWidth"] = true
    chartOptions["low"] = 0
    val paddingObject: dynamic = object {}
    paddingObject["right"] = 40
    chartOptions["chartPadding"] = paddingObject<|endoftext|>


Prompt:
lowHighSurrogates.andNot(another.lowHighSurrogates)

                //A | !B = !((A ^ B) & B)
            } else {
                lowHighSurrogates.xor(another.lowHighSurrogates)
                lowHighSurrogates.and(another.lowHighSurrogates)
                altSurrogates = true
            }

        } else {

Response:
//!A | !B = !(A & B)
            if (altSurrogates) {
                lowHighSurrogates.and(another.lowHighSurrogates)

                //A | B
            } else {
                lowHighSurrogates.or(another.lowHighSurrogates)
            }
        }

        val anotherBits = another.bits<|endoftext|>


Prompt:
open fun renderDescriptor(sb: StringBuilder, descriptor: DeclarationDescriptor, context: RenderingContext, indent: String) {
        sb.append(indent)
        sb.append(INDENTATION_UNIT)
        sb.appendLine(Renderers.COMPACT_WITH_MODIFIERS.render(descriptor, context))
    }
}

Response:
private fun StringBuilder.renderIncompatibilityInformation(
    map: Map<Incompatible<MemberDescriptor>, Collection<MemberDescriptor>>,
    indent: String,
    context: RenderingContext,
    mode: MultiplatformDiagnosticRenderingMode
) {
    for ((incompatibility, descriptors) in map) {
        append(indent)
        append("The following declaration")<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
import org.jetbrains.kotlin.name.Name

Response:
class FirCompositeScope(val scopes: Iterable<FirScope>) : FirScope() {
    override fun processClassifiersByNameWithSubstitution(
        name: Name,
        processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit
    ) {
        for (scope in scopes) {
            scope.processClassifiersByNameWithSubstitution(name, processor)<|endoftext|>


Prompt:
linuxMain.dependsOn(commonMain)
            linuxArm64Main.dependsOn(linuxMain)
            linuxX64Main.dependsOn(linuxMain)
        }
        val linuxTest = kotlin.sourceSets.create("linuxTest") { linuxTest ->
            linuxTest.dependsOn(commonTest)
            linuxArm64Main.dependsOn(linuxTest)

Response:
linuxX64Main.dependsOn(linuxTest)
        }

        val stdlibCoordinates = binaryCoordinates("org.jetbrains.kotlin.native:stdlib:${project.konanVersion}")

        IdeNativeStdlibDependencyResolver.resolve(linuxX64Main).assertMatches(stdlibCoordinates)<|endoftext|>


Prompt:
psi: val foo = getT<Pair<List<Int?>, Pair<List<Int?>?, List<Int>?>>>()
        type: List<Int>?
            typeParameter: <out E> defined in kotlin.collections.List
            typeProjection: Int

Response:
psi: val foo = getT<Pair<List<Int?>, Pair<List<Int?>?, List<Int>?>>>()
            type: Int
*/<|endoftext|>


Prompt:
private fun ObjCNonNullReferenceType.withNullabilityOf(kotlinType: KotlinType): ObjCReferenceType =
        if (kotlinType.binaryRepresentationIsNullable()) {
            ObjCNullableReferenceType(this)
        } else {
            this
        }

Response:
internal fun mapReferenceTypeIgnoringNullability(kotlinType: KotlinType, objCExportScope: ObjCExportScope): ObjCNonNullReferenceType {
        class TypeMappingMatch(val type: KotlinType, val descriptor: ClassDescriptor, val mapper: CustomTypeMapper)<|endoftext|>


Prompt:
interopTask.onlyIf { HostManager.hostIsMac }

                    pod.interopBindingDependencies.forEach { dependencyName ->
                        addPodDependencyToInterop(project, cocoapodsExtension, pod, cinterops, interop, dependencyName)
                    }

                    with(interop) {
                        @Suppress("DEPRECATION") // deprecated property is used intentionally during deprecation period

Response:
defFileProperty.set(defTask.flatMap { it.defFile.asFile })
                        _packageNameProp.set(project.provider { pod.packageName })
                        _extraOptsProp.addAll(project.provider { pod.extraOpts })
                    }

                    val podBuildTaskProvider = project.getPodBuildTaskProvider(target, pod)<|endoftext|>


Prompt:
term = processExpression(char and 0xff00ffff.toInt(), newFlags, last) // Remove flags from the token.
            if (lexemes.currentChar != Lexer.CHAR_RIGHT_PARENTHESIS) {
                throw PatternSyntaxException("unmatched (", pattern, lexemes.curTokenIndex)
            }
            lexemes.next()
        } else {
            // Other terminals.

Response:
when (char) {
                Lexer.CHAR_LEFT_SQUARE_BRACKET -> { // Range: [...]
                    lexemes.next()
                    var negative = false
                    if (lexemes.currentChar == Lexer.CHAR_CARET) {
                        negative = true
                        lexemes.next()
                    }

                    term = processRange(negative, last)<|endoftext|>


Prompt:
}

    @Test fun contentToString() {
        arrayOf("a", 1, null).let { arr -> assertEquals(arr.asList().toString(), arr.contentToString()) }
        charArrayOf('a', 'b', 'd').let { arr -> assertEquals(arr.asList().toString(), arr.contentToString()) }

Response:
intArrayOf(1, 10, 42).let { arr -> assertEquals(arr.asList().toString(), arr.contentToString()) }
        longArrayOf(1L, 5L, Long.MAX_VALUE).let { arr -> assertEquals(arr.asList().toString(), arr.contentToString()) }<|endoftext|>


Prompt:
val b1 = B("1", "2").toString()
    if (b1 != "1#2") return "fail1: $b1"
    val b2 = B("abc").toString()
    if (b2 != "abc#abc") return "fail2: $b2"

    val a1 = A().toString()

Response:
if (a1 != "default#default") return "fail3: $a1"
    val a2 = A("xyz").toString()
    if (a2 != "xyz#default") return "fail4: $a2"

    return "OK"
}<|endoftext|>


Prompt:
package org.jetbrains.kotlin.swiftexport.standalone.builders

import org.jetbrains.kotlin.analysis.api.KtAnalysisApiInternals
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.analyze

Response:
import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeTokenProvider
import org.jetbrains.kotlin.analysis.api.scopes.KtScope
import org.jetbrains.kotlin.analysis.api.standalone.KtAlwaysAccessibleLifetimeTokenProvider<|endoftext|>


Prompt:
val positionToPasteJspecifyMark = fileLinePositions[lineIndexToPasteJspecifyMark]
            val offset = fileLines[lineIndexToPasteJspecifyMark + 1].takeWhile { it == ' ' }.length
            JspecifyMarkerCodeMetaInfo(positionToPasteJspecifyMark, positionToPasteJspecifyMark, offset, jspecifyMark)
        }

Response:
globalMetadataInfoHandler.addMetadataInfosForFile(testFile, newMetaInfos)
    }
}

internal val diagnosticsToJspecifyMarks = mapOf(
    ReportLevel.WARN to mapOf(
        ErrorsJvm.NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS to "jspecify_nullness_mismatch",<|endoftext|>


Prompt:
a.add(0); a.add(0); a.add(0); a.add(0); a.add(0)
    a.add(0); a.add(0); a.add(0); a.add(0); a.add(0)
    var c = 0
    loop@ for (i in a) {
        if (c >= 5) continue@loop
        c++
    }

Response:
return c
}

fun for_double_list(): Int {
    val a = ArrayList<Double>()
    a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0)<|endoftext|>


Prompt:
if (variable.name == SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME) {
            // There can be multiple $completion variables because of inlining, do not duplicate them
            if (method.localVariables.any { it.name == SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME }) continue

Response:
method.extendCompletionsRange(variable, getLastParameterIndex(method.desc, method.access))
            continue
        }
        // this acts like $continuation for lambdas. For example, it is used by debugger to create async stack trace. Keep it.
        if (variable.name == "this" && !isForNamedFunction) {
            method.extendCompletionsRange(variable, 0)<|endoftext|>


Prompt:
private val IrDeclarationWithName.classIdImpl: ClassId?
    get() = when (val parent = this.parent) {
        is IrClass -> parent.classId?.createNestedClassId(this.name)
        is IrPackageFragment -> ClassId.topLevel(parent.packageFqName.child(this.name))
        else -> null
    }

Response:
val IrClass.classIdOrFail: ClassId
    get() = classIdOrFailImpl

val IrTypeAlias.classIdOrFail: ClassId
    get() = classIdOrFailImpl

private val IrDeclarationWithName.classIdOrFailImpl: ClassId
    get() = classIdImpl ?: error("No classId for $this")

val IrFunction.callableId: CallableId<|endoftext|>


Prompt:
fun eqID(x: Any?, y: Any?) = x is Int?      && y is Double?     && x == y
fun eqLD(x: Any?, y: Any?) = x is Long?     && y is Double?     && x == y
fun eqFI(x: Any?, y: Any?) = x is Float?    && y is Int?        && x == y

Response:
fun eqFL(x: Any?, y: Any?) = x is Float?    && y is Long?       && x == y
fun eqIF(x: Any?, y: Any?) = x is Int?      && y is Float?      && x == y
fun eqLF(x: Any?, y: Any?) = x is Long?     && y is Float?      && x == y

fun testNullNull() {<|endoftext|>


Prompt:
?.let { return it.value }

        if (useDefault) {
            val callElement = kotlinOrigin ?: return null
            return analyzeForLightClasses(callElement) {
                val valueParameter = callElement.resolveCall()
                    ?.singleConstructorCallOrNull()
                    ?.symbol
                    ?.valueParameters

Response:
?.find { it.name.identifierOrNullIfSpecial == attributeName }

                when (val psi = valueParameter?.psi) {
                    is KtParameter -> {
                        psi.defaultValue?.let { defaultValue ->
                            defaultValue.evaluateAsAnnotationValue()?.toAnnotationMemberValue(parameterList)
                        }
                    }
                    is PsiAnnotationMethod -> psi.defaultValue<|endoftext|>


Prompt:
// MODULE: m1-common
// FILE: common.kt
annotation class Ann

expect class A {
    class B {
        class C {
            @Ann
            fun foo()
        }
    }
}

// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
actual class A {
    actual class B {
        actual class C {

Response:
<!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>actual fun foo() {}<!>
        }
    }
}<|endoftext|>


Prompt:
abstract class A

fun foo(i: Int) {}

<!VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION!>value<!> class B(val i: Int) : @Suppress(<!ERROR_SUPPRESSION!>"VALUE_CLASS_CANNOT_EXTEND_CLASSES"<!>) A() {

Response:
@Suppress(<!ERROR_SUPPRESSION!>"SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS"<!>)
    constructor() : this(42) {
        foo(i)
    }

    @Suppress(<!ERROR_SUPPRESSION!>"ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS"<!>)<|endoftext|>


Prompt:
// This file was generated automatically. See compiler/fir/tree/tree-generator/Readme.md.
// DO NOT MODIFY IT MANUALLY.

@file:Suppress("DuplicatedCode", "unused")

package org.jetbrains.kotlin.fir.expressions.builder

import org.jetbrains.kotlin.KtSourceElement

Response:
import org.jetbrains.kotlin.fir.FirTarget
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
import org.jetbrains.kotlin.fir.expressions.FirLoop<|endoftext|>


Prompt:
import org.jetbrains.kotlin.asJava.elements.KtLightField
import org.jetbrains.kotlin.asJava.elements.KtLightMethod
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
import org.jetbrains.kotlin.fileClasses.isJvmMultifileClassFile

Response:
import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName
import org.jetbrains.kotlin.light.classes.symbol.analyzeForLightClasses
import org.jetbrains.kotlin.light.classes.symbol.annotations.*
import org.jetbrains.kotlin.light.classes.symbol.cachedValue<|endoftext|>


Prompt:
fun box(): String {
    // On the JVM, this call adds some locals with reference types to the LVT
    // which end after the call returns.
    spray()
    // When inlining `f` we'll reuse the same slots that previously contained
    // locals with reference types for the $i$f$f and $i$a$-f-... variables.

Response:
// Since these locals have integer types D8 would produce a warning if they
    // started before being initialized, which would cause the test to fail.
    return f()
}<|endoftext|>


Prompt:
@Throws(MyException::class) fun int(): Int
    @Throws(MyException::class) fun longN(): Long?
    @Throws(MyException::class) fun double(): Double

    interface UnitCaller {
        @Throws(MyException::class) fun call(methods: MethodsWithThrows): Unit
    }
}

open class Throwing : MethodsWithThrows {

Response:
@Throws(MyException::class) constructor(doThrow: Boolean) {
        if (doThrow) throw MyException()
    }

    override fun unit(): Unit = throw MyException()
    override fun nothing(): Nothing = throw MyException()
    override fun nothingN(): Nothing? = throw MyException()
    override fun any(): Any = throw MyException()<|endoftext|>


Prompt:
builder {
        inlineMe {
            StateMachineChecker.suspendHere()
            StateMachineChecker.suspendHere()
        }.run1()
    }
    StateMachineChecker.check(4)
    StateMachineChecker.reset()
    builder {
        inlineMe {
            StateMachineChecker.suspendHere()
            StateMachineChecker.suspendHere()
        }.run2()
    }

Response:
StateMachineChecker.check(2)
    StateMachineChecker.reset()

    builder {
        inlineMe2 {
            StateMachineChecker.suspendHere()
            StateMachineChecker.suspendHere()
        }.run()
    }
    StateMachineChecker.check(8)
    StateMachineChecker.reset()

    builder {
        inlineMe2 {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
import org.jetbrains.kotlin.analysis.api.types.KtType
import org.jetbrains.kotlin.analysis.utils.printer.PrettyPrinter
import org.jetbrains.kotlin.analysis.utils.printer.prettyPrint

internal object TestScopeRenderer {

Response:
fun renderForTests(
        analysisSession: KtAnalysisSession,
        scopeContext: KtScopeContext,
        printer: PrettyPrinter,
        printPretty: Boolean = false,
        fullyPrintScope: (KtScopeKind) -> Boolean,
    ) {
        with(analysisSession) {
            with(printer) {
                appendLine("implicit receivers:")

                withIndent {<|endoftext|>


Prompt:
JsAstUtils.or(
                                    namespaceRef,
                                    jsAssignment(
                                        namespaceRef,
                                        JsObjectLiteral()
                                    )
                                )
                            )
                        )
                        JsNameRef(varName)
                    }
                    currentRef = newNameSpaceRef
                    currentNamespace = newNamespace
                }

Response:
statements + declaration.declarations.flatMap { generateDeclarationExport(it, currentRef, esModules) }
            }

            is ExportedFunction -> {
                val name = staticContext.getNameForStaticDeclaration(declaration.ir)
                when {
                    namespace != null -><|endoftext|>


Prompt:
val dispatchReceiverType = descriptor.dispatchReceiverParameter?.type
        val valueParameterTypes = resolvedAtom?.parameters ?: descriptor.valueParameters.map { it.type }

        require(returnType != null)

        val substitutedReturnType = returnType.substituteAndApproximate(substitutor).also {
            descriptor.setReturnType(it.approximatedType)

Response:
}

        fun ReceiverParameterDescriptor.setOutTypeIfNecessary(processedType: FunctionLiteralTypes.ProcessedType) {
            if (this is ReceiverParameterDescriptorImpl && type.shouldBeUpdated()) {
                setOutType(processedType.approximatedType)
            }
        }

        val extensionReceiverFromDescriptor = descriptor.extensionReceiverParameter<|endoftext|>


Prompt:
// FIR_IDENTICAL
// SKIP_TXT
// FILE: AbstractMapAssert.java

import java.util.Map;

public abstract class AbstractMapAssert<SELF extends AbstractMapAssert<SELF, ACTUAL, K, V>, ACTUAL extends Map<K, V>, K, V> {
    public SELF isNotNull() {
        return (SELF) this;
    }
}

Response:
// FILE: MapAssert.java

import java.util.Map;

public class MapAssert<KEY, VALUE> extends AbstractMapAssert<MapAssert<KEY, VALUE>, Map<KEY, VALUE>, KEY, VALUE> {

    public MapAssert(Map<KEY, VALUE> actual) {}
}

// FILE: Assertions.java

import java.util.Map;<|endoftext|>


Prompt:
<!WRONG_MODIFIER_TARGET!>reified<!>
    <!WRONG_MODIFIER_TARGET!>enum<!>
    <!WRONG_MODIFIER_TARGET!>private<!>
    <!WRONG_MODIFIER_TARGET!>const<!>
    a: Int)

//Check multiple illegal modifiers in constructor

Response:
class IllegalModifiers2(<!WRONG_MODIFIER_TARGET!>private<!> <!INCOMPATIBLE_MODIFIERS!>abstract<!> a: Int)

//Check annotations with illegal modifiers in constructor<|endoftext|>


Prompt:
JsClassModel(rename(cls.name), cls.superName?.let { rename(it) }).apply {
                postDeclarationBlock.statements += rename(cls.postDeclarationBlock).statements
                cls.interfaces.mapTo(interfaces) { rename(it) }
            }
        }
        fragment.classes.clear()

Response:
fragment.classes += classes.map { it.name to it }

        fragment.inlineModuleMap.forEach { (_, value) -> rename(value) }

        fragment.tests?.let { rename(it) }
        fragment.mainFunction?.let { rename(it) }
        fragment.inlinedLocalDeclarations.values.forEach { rename(it) }<|endoftext|>


Prompt:
else -> KotlinTypeFactory.flexibleType(lowerResult.type ?: lowerBound, upperResult.type ?: upperBound)
                }
                Result(type, lowerResult.subtreeSize)
            }
            is SimpleType -> {
                val result = enhanceInflexible(
                    qualifiers, index, TypeComponentPosition.INFLEXIBLE, isSuperTypesEnhancement = isSuperTypesEnhancement
                )

Response:
Result(if (result.forWarnings) wrapEnhancement(result.type) else result.type, result.subtreeSize)
            }
        }
    }

    private fun SimpleType.enhanceInflexible(
        qualifiers: (Int) -> JavaTypeQualifiers,
        index: Int,
        position: TypeComponentPosition,
        isBoundOfRawType: Boolean = false,<|endoftext|>


Prompt:
val failuresNumber = elementToInt(data.getRequiredField("failuresNumber"), "failuresNumber")
                return Build(buildNumber, startTime, finishTime, branch, commits, failuresNumber)
            } else {
                error("Top level entity is expected to be an object. Please, check origin files.")
            }
        }
    }

Response:
private fun formatTime(time: String, targetZone: Int = 3): String {
        val matchResult = "^\\d{8}T(\\d{2})(\\d{2})\\d{2}((\\+|-)\\d{2})".toRegex().find(time)?.groupValues
        matchResult?.let {
            val timeZone = matchResult[3].toInt()<|endoftext|>


Prompt:
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.KotlinCliJavaFileManager
import org.jetbrains.kotlin.util.PerformanceCounter
import org.jetbrains.kotlin.utils.addIfNotNull

Response:
// TODO: do not inherit from CoreJavaFileManager to avoid accidental usage of its methods which do not use caches/indices
// Currently, the only relevant usage of this class as CoreJavaFileManager is at CoreJavaDirectoryService.getPackage,
// which is indirectly invoked from PsiPackage.getSubPackages<|endoftext|>


Prompt:
package org.jetbrains.kotlin.descriptors.impl

import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PropertyAccessorDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.SourceElement

Response:
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.name.Name

class SyntheticFieldDescriptor private constructor(
    val propertyDescriptor: PropertyDescriptor,
    accessorDescriptor: PropertyAccessorDescriptor,
    sourceElement: SourceElement
) : LocalVariableDescriptor(<|endoftext|>


Prompt:
package org.jetbrains.kotlin.gradle.idea.tcs.extras

import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinBinaryDependency
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinClasspath

Response:
import org.jetbrains.kotlin.tooling.core.extrasKeyOf
import org.jetbrains.kotlin.tooling.core.lazyProperty

/* Sources (-sources.jar) */

val sourcesClasspathKey = extrasKeyOf<IdeaKotlinClasspath>("sourcesClasspath")

/**
 * Contains all resolved -sources.jar artifacts associated with this dependency
 */<|endoftext|>


Prompt:
private fun test() = "K"

fun box(): String {

    val clazz = Class.forName("test.TestKt")
    assertEquals(2, clazz.declaredMethods.size, "Facade should have only box method")
    val methods = clazz.declaredMethods.map { it.name }
    assertTrue(methods.contains("box"), "Facade should have box method")

Response:
assertTrue(methods.contains("getProp"), "Facade should have box method")

    return {
        prop = "O"
        prop + test()
    }.let { it() }
}<|endoftext|>


Prompt:
fun <T> bar(ff: <!UNRESOLVED_REFERENCE!>Err<!>.() -> Unit) {
}

// MODULE: m2(m1)
// FILE: foo.kt

data class User(val surname: String)

fun foo() {
    bar<String> {

Response:
<!DEBUG_INFO_MISSING_UNRESOLVED!>User<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>surname<!>
    }
}<|endoftext|>


Prompt:
"invalid file name '${file.absolutePath}'; must end either with '.js', '.zip' or '.jar'"
                        )
                        emptyList()
                    }
                }
            }
            else -> {
                messageCollector.report(CompilerMessageSeverity.ERROR, "source file or directory not found: $fileName")
                emptyList()
            }
        }
    }

Response:
private fun singleInputFile(baseDir: File, path: String): InputFile {
        val moduleName = getModuleNameFromPath(path)
        val pathToSourceMapCandidate = "$path.map"
        val pathToSourceMap = if (File(pathToSourceMapCandidate).exists()) pathToSourceMapCandidate else null
        return InputFile(<|endoftext|>


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

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


Prompt:
import org.jetbrains.kotlin.ir.util.getPackageFragment

internal abstract class KonanBackendContext(config: KonanConfig) : BasicPhaseContext(config), CommonBackendContext {
    abstract override val builtIns: KonanBuiltIns

    abstract override val ir: KonanIr

    override val scriptMode: Boolean = false

    override val sharedVariablesManager by lazy {

Response:
// Creating lazily because builtIns module seems to be incomplete during `link` test;
        // TODO: investigate this.
        KonanSharedVariablesManager(this)
    }

    override val internalPackageFqn = KonanFqNames.internalPackageName

    override val mapping: NativeMapping = NativeMapping()

    override val irFactory: IrFactory = IrFactoryImpl
}<|endoftext|>


Prompt:
fun KtDeclaration.resolveToFirSymbol(
    firResolveSession: LLFirResolveSession,
    phase: FirResolvePhase = FirResolvePhase.RAW_FIR,
): FirBasedSymbol<*> {
    return firResolveSession.resolveToFirSymbol(this, phase)
}

/**

Response:
* Creates [FirBasedSymbol] by [KtDeclaration] .
 * returned [FirDeclaration] will be resolved at least to [phase]
 *
 * If resulted [FirBasedSymbol] is not subtype of [S], throws [InvalidFirElementTypeException]
 */
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")<|endoftext|>


Prompt:
import org.jetbrains.kotlin.test.util.trimTrailingWhitespacesAndAddNewlineAtEOF
import org.jetbrains.kotlin.test.utils.withExtension
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
import java.io.File
import java.util.*

Response:
internal class Kapt4Handler(testServices: TestServices) : AnalysisHandler<Kapt4ContextBinaryArtifact>(
    testServices,
    failureDisablesNextSteps = true,
    doNotRunIfThereWerePreviousFailures = true
) {
    override val artifactKind: TestArtifactKind<Kapt4ContextBinaryArtifact>
        get() = Kapt4ContextBinaryArtifact.Kind<|endoftext|>


Prompt:
assertTasksExecuted(":compileProductionExecutableKotlinWasmJs")
                assertTasksExecuted(":compileProductionExecutableKotlinWasmJsOptimize")
                assertTasksExecuted(":wasmJsBrowserDistribution")

Response:
assertFileInProjectExists("build/${Distribution.DIST}/wasmJs/productionExecutable/redefined-wasm-module-name.wasm")
                assertFileInProjectExists("build/${Distribution.DIST}/wasmJs/productionExecutable/new-mpp-wasm-js.js")<|endoftext|>


Prompt:
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.utils.flatMapToNullableSet

/**
 * A [FirSymbolNamesProvider] that caches all name sets.
 */
abstract class FirCachedSymbolNamesProvider(protected val session: FirSession) : FirSymbolNamesProvider() {
    abstract fun computePackageNames(): Set<String>?

Response:
/**
     * This function is only called if [hasSpecificClassifierPackageNamesComputation] is `true`. Otherwise, the classifier package set will
     * be taken from the cached general package names to avoid building duplicate sets.
     */
    abstract fun computePackageNamesWithTopLevelClassifiers(): Set<String>?<|endoftext|>


Prompt:
contract { returns(true) implies (value_1 == null) }
    return value_1 == null
}
fun case_5_3(value_1: Int?): Boolean {
    contract { returns(false) implies (value_1 != null) }
    return !(value_1 != null)
}
fun case_5_4(value_1: Int?): Boolean {

Response:
contract { returns(false) implies (value_1 == null) }
    return !(value_1 == null)
}
fun case_5_5(value_1: Int?): Boolean? {
    contract { returnsNotNull() implies (value_1 != null) }
    return if (value_1 != null) true else null
}
fun case_5_6(value_1: Int?): Boolean? {<|endoftext|>


Prompt:
// TARGET_BACKEND: JVM
// WITH_STDLIB
// JVM_ABI_K1_K2_DIFF: KT-63843

import kotlin.test.assertEquals

annotation class Name(val value: String)

annotation class Anno(
    @get:Name("O") val o: String,
    @get:Name("K") val k: String
)

Response:
fun box(): String {
    val ms = Anno::class.java.declaredMethods

    return (ms.single { it.name == "o" }.annotations.single() as Name).value +
            (ms.single { it.name == "k" }.annotations.single() as Name).value
}<|endoftext|>


Prompt:
// FIR_IDENTICAL
class Pair<out A, out B>(val first: A, val second: B)

class Example {
    infix fun to(other: Example) = Pair(this, other)
    fun toNonInfix(other: Example) = Pair(this, other)
}

infix fun Example.toExt(other: Example) = Pair(this, other)

Response:
fun Example.toExtNonInfix(other: Example) = Pair(this, other)

<!INAPPLICABLE_INFIX_MODIFIER!>infix<!> fun Example.toExtWithExtraParams(other: Example, blah: Int = 0) = Pair(this, other)<|endoftext|>


Prompt:
container.findDefaultMethod(jvmSignature.methodName, jvmSignature.methodDesc, !Modifier.isStatic(caller.member!!.modifiers)) as Member?
            }
            is KotlinConstructor -> {
                if (isAnnotationConstructor)

Response:
return@defaultCaller AnnotationConstructorCaller(container.jClass, parameters.map { it.name!! }, CALL_BY_NAME, KOTLIN)
                container.findDefaultConstructor(jvmSignature.constructorDesc) as Member?
            }
            is FakeJavaAnnotationConstructor -> {
                val methods = jvmSignature.methods<|endoftext|>


Prompt:
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// !LANGUAGE: -ProperIeee754Comparisons
// DONT_TARGET_EXACT_BACKEND: JS_IR
// DONT_TARGET_EXACT_BACKEND: JS_IR_ES6

fun equals1(a: Float, b: Float?) = a == b

Response:
fun equals2(a: Float?, b: Float?) = a!! == b!!

fun equals3(a: Float?, b: Float?) = a != null && a == b

fun equals4(a: Float?, b: Float?) = if (a is Float) a == b else null!!

fun equals5(a: Any?, b: Any?) = if (a is Float && b is Float?) a == b else null!!<|endoftext|>


Prompt:
override fun <D> transformTypeParameters(transformer: FirTransformer<D>, data: D): FirAnonymousObjectImpl {
        typeParameters.transformInplace(transformer, data)
        return this
    }

    override fun <D> transformStatus(transformer: FirTransformer<D>, data: D): FirAnonymousObjectImpl {
        status = status.transform(transformer, data)
        return this

Response:
}

    override fun <D> transformSuperTypeRefs(transformer: FirTransformer<D>, data: D): FirAnonymousObjectImpl {
        superTypeRefs.transformInplace(transformer, data)
        return this
    }

    override fun <D> transformDeclarations(transformer: FirTransformer<D>, data: D): FirAnonymousObjectImpl {<|endoftext|>


Prompt:
if (b) x<!UNSAFE_CALL!>.<!>length
    if (c) x<!UNSAFE_CALL!>.<!>length
    callLambdaWithoutContract { b = true }
    if (b) x<!UNSAFE_CALL!>.<!>length
    if (c) x<!UNSAFE_CALL!>.<!>length
}

Response:
fun testNotNullViaVariableLambda(x: StringHolder) {
    val a = x.value != null
    var b = a
    val c = b
    if (b) x.value<!UNSAFE_CALL!>.<!>length
    if (c) x.value<!UNSAFE_CALL!>.<!>length
    callLambdaWithoutContract { b = true }<|endoftext|>


Prompt:
val jvmMainCompilation = kotlin.jvm().compilations.getByName("main")
        @Suppress("DEPRECATION")
        jvmMainCompilation.compilerOptions.options.languageVersion.set(KotlinVersion.KOTLIN_2_0)

        project.evaluate()

Response:
val jvmMainCompileTask = jvmMainCompilation.compileTaskProvider.get() as KotlinCompile
        val arguments = jvmMainCompileTask.createCompilerArguments(lenient)

        assertEquals(
            setOf("commonMain", "jvmMain"),
            arguments.assertNotNull(CommonCompilerArguments::fragments).toSet()
        )
    }<|endoftext|>


Prompt:
fun FirAnnotation.getBooleanArgument(name: Name, session: FirSession): Boolean? = getPrimitiveArgumentValue(name, session)
fun FirAnnotation.getStringArgument(name: Name, session: FirSession): String? = getPrimitiveArgumentValue(name, session)

Response:
private inline fun <reified T> FirAnnotation.getPrimitiveArgumentValue(name: Name, session: FirSession): T? {
    val argument = findArgumentByName(name) ?: return null
    val literal = argument.evaluateAs<FirLiteralExpression<*>>(session) ?: return null
    return literal.value as? T
}<|endoftext|>


Prompt:
class Other : Base

fun <K> id(arg: K): K = arg

fun test1(arg: Derived) {
    id<Inv<Base>>(Inv(arg))
    id<Inv<Base>>(<!TYPE_MISMATCH!>InvExact(arg)<!>)
}

Response:
fun <R> Inv<@Exact R>.select(first: R, second: R): R = TODO()

fun test2(derived: Derived, other: Other) {
    Inv(derived).select(derived, <!TYPE_MISMATCH!>other<!>)
}<|endoftext|>


Prompt:
emptyList()
        else
            getDeserializedCallables(compiledPackageFragment)

    private fun getDeserializedCallables(compiledPackageFragment: PackageFragmentDescriptor) =
        compiledPackageFragment.getMemberScope()
            .getContributedDescriptors(DescriptorKindFilter.CALLABLES, MemberScope.ALL_NAME_FILTER)

Response:
.filterIsInstance<DeserializedCallableMemberDescriptor>()

    private val shouldGeneratePartHierarchy =
        state.languageVersionSettings.getFlag(JvmAnalysisFlags.inheritMultifileParts)

    private val partInternalNamesSorted = run {
        val partInternalNamesSet = hashSetOf<String>()
        for (file in files) {<|endoftext|>


Prompt:
const val KOTLIN_JAVA_RUNTIME_JRE7_NAME = "kotlin-stdlib-jre7"
    const val KOTLIN_JAVA_RUNTIME_JRE7_JAR = "$KOTLIN_JAVA_RUNTIME_JRE7_NAME.jar"

Response:
const val KOTLIN_JAVA_RUNTIME_JRE7_SRC_JAR = "$KOTLIN_JAVA_RUNTIME_JRE7_NAME-sources.jar"

    const val KOTLIN_JAVA_RUNTIME_JDK7_NAME = "kotlin-stdlib-jdk7"<|endoftext|>


Prompt:
val inlinedClass = type.getInlinedClass() ?: return element
            val field = getInlineClassBackingField(inlinedClass)
            return IrGetFieldImpl(startOffset, endOffset, field.symbol, field.type, this)
        }
    }

    fun toPrimitiveArrayLiteral(elements: List<IrExpression>) =

Response:
elements.toArrayLiteral(context, primitiveArrayType, primitiveElementType)
}<|endoftext|>


Prompt:
}

/**
 * Returns the greater of the given values.
 *
 * If there are multiple equal maximal values, returns the first of them.
 */
@SinceKotlin("1.4")
public expect fun <T : Comparable<T>> maxOf(a: T, vararg other: T): T

/**
 * Returns the greater of the given values.
 */
@SinceKotlin("1.4")

Response:
public expect fun maxOf(a: Byte, vararg other: Byte): Byte

/**
 * Returns the greater of the given values.
 */
@SinceKotlin("1.4")
public expect fun maxOf(a: Short, vararg other: Short): Short

/**
 * Returns the greater of the given values.
 */
@SinceKotlin("1.4")<|endoftext|>


Prompt:
* Two arrays are considered structurally equal if they have the same size, and elements at corresponding indices are equal.
 * Elements are compared for equality using the [equals][Any.equals] function.
 * This means `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
 *
 * The arrays are also considered structurally equal if both are `null`.
 *

Response:
* @param other the array to compare with this array.
 * @return `true` if the two arrays are structurally equal, `false` otherwise.
 *
 * @sample samples.collections.Arrays.ContentOperations.doubleArrayContentEquals
 */
@SinceKotlin("1.4")
public actual infix fun FloatArray?.contentEquals(other: FloatArray?): Boolean {<|endoftext|>


Prompt:
assertContains(commandParts, "-XX:+UseCodeCacheFlushing")
    }

    @DisplayName("-XX:-UseParallelGC is handled")
    @Test
    fun testDisablingParallelGC() {
        val commandParts = leaseSessionAndExtractCommand(listOf("XX:-UseParallelGC"))

Response:
assert(commandParts.none { it.startsWith("-XX:+Use") && it.endsWith("GC") }) {
            "Expected no explicitly enabled garbage collector via JVM arguments: $commandParts"
        }
    }

    private fun leaseSessionAndExtractCommand(additionalJvmArguments: List<String> = emptyList()): List<String> {<|endoftext|>


Prompt:
val MAX_VERTEX_TEXTURE_IMAGE_UNITS: Int
        val MAX_TEXTURE_IMAGE_UNITS: Int
        val MAX_FRAGMENT_UNIFORM_VECTORS: Int
        val SHADER_TYPE: Int
        val DELETE_STATUS: Int
        val LINK_STATUS: Int
        val VALIDATE_STATUS: Int

Response:
val ATTACHED_SHADERS: Int
        val ACTIVE_UNIFORMS: Int
        val ACTIVE_ATTRIBUTES: Int
        val SHADING_LANGUAGE_VERSION: Int
        val CURRENT_PROGRAM: Int
        val NEVER: Int
        val LESS: Int
        val EQUAL: Int
        val LEQUAL: Int
        val GREATER: Int<|endoftext|>


Prompt:
// MODULE: main(cinterop)
// FILE: main.kt

@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)

import kotlinx.cinterop.*
import kotlin.test.*
import structAnonym.*

fun box(): String {
    retByValue_StructAnonRecordMember_ImplicitAlignment()
        .useContents {

Response:
assertEquals(1, a[0])
            assertEquals(4, a[3])
            assertEquals(42, b)
        }

    return "OK"
}<|endoftext|>


Prompt:
"Compiler behavior in such mode is undefined; please, consider moving to the latest stable version " +
                        "or turning off progressive mode."
            )
        }
    }

    protected open fun defaultLanguageVersion(collector: MessageCollector): LanguageVersion =
        LanguageVersion.LATEST_STABLE

    protected open fun checkPlatformSpecificSettings(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {

Response:
}

    protected open fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
        // backend-specific
    }

    private enum class VersionKind(val text: String) {
        LANGUAGE("Language"), API("API")
    }

    private fun parseOrConfigureLanguageVersion(collector: MessageCollector): LanguageVersion {<|endoftext|>


Prompt:
"org.jetbrains.kotlin.native.framework.name",
            String::class.java
        )
    }
}

private val hostManager by lazy { HostManager() }

private val targetsEnabledOnAllHosts by lazy { hostManager.enabledByHost.values.reduce { acc, targets -> acc intersect targets } }

/**

Response:
* The set of konanTargets is considered 'host specific' if the shared compilation of said set can *not* be built
 * on *all* potential hosts. e.g. a set like (iosX64, macosX64) can only be built on macos hosts, and is therefore considered
 * 'host specific'.
 */<|endoftext|>


Prompt:
fun case_3(value_1: Boolean): Int = <!NO_ELSE_IN_WHEN!>when<!>(value_1) { }

// TESTCASE NUMBER: 4
fun case_4(value_1: Boolean): String = <!NO_ELSE_IN_WHEN!>when<!> {
    value_1 == true -> ""
    value_1 == false -> ""
}

Response:
/*
 * TESTCASE NUMBER: 5
 * DISCUSSION: maybe use const propagation here?
 * ISSUES: KT-25265
 */
fun case_5(value_1: Boolean): String {
    val trueValue = true
    val falseValue = false

    return <!NO_ELSE_IN_WHEN!>when<!> (value_1) {
        trueValue -> ""<|endoftext|>


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

Response:
if (b != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float"), DEBUG_INFO_SMARTCAST!>this.b<!>.equals(null)
        if (b != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float"), DEBUG_INFO_SMARTCAST!>this.b<!>.propT<|endoftext|>


Prompt:
import org.jetbrains.kotlin.js.translate.context.TemporaryConstVariable
import org.jetbrains.kotlin.js.translate.context.TranslationContext
import org.jetbrains.kotlin.js.translate.expression.PatternTranslator
import org.jetbrains.kotlin.js.translate.general.AbstractTranslator

Response:
import org.jetbrains.kotlin.js.translate.general.Translation
import org.jetbrains.kotlin.js.translate.intrinsic.functions.factories.ArrayFIF
import org.jetbrains.kotlin.js.translate.utils.AnnotationsUtils
import org.jetbrains.kotlin.js.translate.utils.JsAstUtils<|endoftext|>


Prompt:
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun testVarianceDifferentReturnTypesEReverse(): Invariant<*> = Invariant<UserKlass>()

    @Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun testVarianceDifferentReturnTypesF(): Invariant<out UserKlass> = Invariant()

Response:
fun testVarianceDifferentReturnTypesF(): Invariant<in UserKlass> = Invariant()

    fun testVarianceDifferentReturnTypesFReverse(): Invariant<out UserKlass> = Invariant()
    @Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun testVarianceDifferentReturnTypesFReverse(): Invariant<in UserKlass> = Invariant()<|endoftext|>


Prompt:
assertFalse("Nothing found in package ${LoadDescriptorUtil.TEST_PACKAGE_FQNAME}", packageView.isEmpty())

        val expectedFile = File(ktFilePath.replaceFirst("\\.kt$".toRegex(), ".txt"))
        validateAndCompareDescriptorWithFile(packageView, CONFIGURATION, expectedFile)
    }

    fun compileKotlinWithJava(

Response:
javaFiles: List<File>,
        kotlinFiles: List<File>,
        outDir: File,
        disposable: Disposable,
        aptMode: Boolean
    ): Boolean {
        val environment = createEnvironmentWithMockJdkAndIdeaAnnotations(disposable)
        updateConfiguration(environment.configuration)<|endoftext|>


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

fun <T> foo(a: Array<T>): Array<Array<T>> = throw Exception()

fun test1(a1: Array<out Int>) {
    val b1: Array<out Array<out Int>> = foo(a1)

Response:
val c1 = foo(a1)
    c1 checkType { _<Array<out Array<out Int>>>() }
}

fun test2(a2: Array<in Int>) {
    val b2: Array<out Array<in Int>> = foo(a2)
    val c2 = foo(a2)
    c2 checkType { _<Array<out Array<in Int>>>() }
}<|endoftext|>


Prompt:
* PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2
 * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 11 -> sentence 1
 * NUMBER: 3

Response:
* DESCRIPTION: The sets of non-extension member callables named f of type T;
 */

class Marker {
    fun foo() = println("non-extension member toplevel Marker.foo()")
    val foo: String = "non-extension member toplevel Marker.foo"
}

// TESTCASE NUMBER: 1
class Case1() {<|endoftext|>


Prompt:
Files.write(file1, "other".toByteArray())
                registerAddedOrChangedFile(file2)
                Files.write(file2, "other".toByteArray())
                markAsSuccessful()
                throw Exception()
            }
        }
        assertEquals("something", String(Files.readAllBytes(file1)))
        assertFalse(Files.exists(file2))
    }

Response:
@Test
    fun testChangesAreRevertedOnCachesCloseException() {
        val file1 = workingDir.resolve("1.txt")
        val file2 = workingDir.resolve("2.txt")
        Files.write(file1, "something".toByteArray())
        assertThrows<CachesManagerCloseException> {
            useTransaction {
                cachesManager = CacheMock(true)<|endoftext|>


Prompt:
throw java.lang.IllegalArgumentException()
    }
    // x *is* initialized here, because if myRun was never called -> exception
    // were thrown and control flow wouldn't be here
    println(x)
}

fun catchThrowIfNotCalled() {
    val x: Int
    try {
        myRun outer@ {
            unknownRun {
                myRun {
                    x = 42

Response:
return@outer
                }
            }
            throw java.lang.IllegalArgumentException()
        }
    } catch (ignored: java.lang.IllegalArgumentException) { }

    // x *isn't* initialized here!
    println(<!UNINITIALIZED_VARIABLE!>x<!>)
}<|endoftext|>


Prompt:
var Results: CPointer<CXCompletionResult>?
        get() = memberAt<CPointerVar<CXCompletionResult>>(0).value
        set(value) { memberAt<CPointerVar<CXCompletionResult>>(0).value = value }

    var NumResults: Int
        get() = memberAt<IntVar>(8).value

Response:
set(value) { memberAt<IntVar>(8).value = value }
}

@CNaturalStruct("context", "visit")
class CXCursorAndRangeVisitor(rawPtr: NativePtr) : CStructVar(rawPtr) {<|endoftext|>


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

Response:
<!CONFLICTING_OVERLOADS!>open fun <T: Invariant<in UserInterface>> testTypeParameterWithVarianceDifferentUpperBoundsF()<!> {}

    <!CONFLICTING_OVERLOADS!>open fun <T: Invariant<out UserInterface>> testTypeParameterWithVarianceDifferentUpperBoundsFReverse()<!> {}<|endoftext|>


Prompt:
checkExactType<Buildee<Any?>>(buildee)
}

class TargetType

fun consumeNullableAny(value: Any?) {}

open class Buildee<TV> {
    fun getTypeVariable(): TV = storage
    private var storage: TV = null!!
}

class DerivedBuildee<TA>: Buildee<TA>()

Response:
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
    return DerivedBuildee<PTV>().apply(instructions)
}<|endoftext|>


Prompt:
assertEquals(0.052, "+5.2e-2d".toDouble())
        assertEquals(52340000000.0, "+5.234e+10d".toDouble())
        assertEquals(5.234E123, "+5.234e+123d".toDouble())
        assertEquals(5.234E123, "+5.234e+123f".toDouble())

Response:
assertEquals(5.234E123, "+5.234e+123".toDouble())
        assertEquals(5.5, "5.5f".toDouble())
        assertEquals(2.71, "\u0009 \u000A 2.71 \u000D".toDouble())
        assertEquals(42.3, "\n 42.3 ".toDouble())<|endoftext|>


Prompt:
private val trace: BindingTrace,
    private val argumentType: KotlinType,
    private val typeParameterDescriptor: TypeParameterDescriptor,
    private val baseDiagnostic: DiagnosticFactory2<KtTypeReference, KotlinType, KotlinType> = UPPER_BOUND_VIOLATED,

Response:
private val diagnosticForTypeAliases: DiagnosticFactory3<KtElement, KotlinType, KotlinType, ClassifierDescriptor> = UPPER_BOUND_VIOLATED_IN_TYPEALIAS_EXPANSION
) {
    fun report(typeArgumentReference: KtTypeReference, substitutedBound: KotlinType) {<|endoftext|>


Prompt:
checkNotEqual(id(c0::target1), id(c1::target1))
    checkNotEqual(id(c0::target1), id(c1::target2))
    checkNotEqual(id(c0::adapted1), id(c1::adapted1))

    return "OK"
}

// FILE: fromOtherFile.kt

Response:
private fun id(f: Runnable): Any = f

fun target1FromOtherFile(c0: C): Any = id(c0::target1)
fun adapted1FromOtherFile(c0: C): Any = id(c0::adapted1)
fun adapted2FromOtherFile(c0: C): Any = id(c0::adapted2)<|endoftext|>


Prompt:
internal inline fun generateExpressionValue(type: IrType, crossinline generate: () -> IrExpression) =
    object : ExpressionValue(type) {
        override fun load(): IrExpression = generate()
    }

internal class OnceExpressionValue(val irExpression: IrExpression) : LValue, AssignmentReceiver {
    private var instantiated = false

    override fun load(): IrExpression {

Response:
if (instantiated) throw AssertionError("Single expression value for ${irExpression.render()} is already instantiated")
        instantiated = true
        return irExpression
    }

    override val type: IrType get() = irExpression.type

    override fun store(irExpression: IrExpression): IrExpression {<|endoftext|>


Prompt:
if (this@BaseIrGenerator !is SerializableCompanionIrGenerator) {
                    // otherwise call Companion.serializer()
                    callSerializerFromCompanion(kType, typeArgs, emptyList(), enumSerializerId)?.let { return it }
                }

                val enumArgs = mutableListOf(
                    irString(kType.serialName()),

Response:
irCall(enumDescriptor.owner.findEnumValuesMethod()),
                )

                if (enumSerializerFactoryFunc != null && annotatedEnumSerializerFactoryFunc != null) {
                    // runtime contains enum serializer factory functions
                    val factoryFunc: IrSimpleFunctionSymbol = if (enumDescriptor.owner.isEnumWithSerialInfoAnnotation()) {<|endoftext|>


Prompt: ExpectedData(0x5408a1df99d4affUL, 0x7da9e81d89fda7adUL, 0x274157cabe71440dUL, 0x2c22d9a480b331f7UL, 0xe835c8ac746472d5UL),

Response: ExpectedData(0xa8b27a6bcaeeed4bUL, 0xd45a938b79f54e8fUL, 0x366b219d6d133e48UL, 0x5b14be3c25c49405UL, 0xfdd791d48811a572UL),<|endoftext|>


Prompt:
) : KtAbstractFirDiagnostic<KtBackingField>(firDiagnostic, token), KtFirDiagnostic.PropertyFieldDeclarationMissingInitializer

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

Response:
) : KtAbstractFirDiagnostic<KtBackingField>(firDiagnostic, token), KtFirDiagnostic.LateinitPropertyFieldDeclarationWithInitializer

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


Prompt:
package org.jetbrains.kotlin.analysis.api.fir.components

import org.jetbrains.kotlin.analysis.api.components.KtSubstitutorProvider
import org.jetbrains.kotlin.analysis.api.fir.KtFirAnalysisSession
import org.jetbrains.kotlin.analysis.api.fir.utils.firSymbol

Response:
import org.jetbrains.kotlin.analysis.api.symbols.KtClassOrObjectSymbol
import org.jetbrains.kotlin.analysis.api.types.KtSubstitutor
import org.jetbrains.kotlin.fir.resolve.substitution.chain
import org.jetbrains.kotlin.fir.scopes.substitutorForSuperType<|endoftext|>


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

fun testR1xE11() {
    // with possible local optimizations

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


Prompt:
wasCalled = true
        }
    }

    builder(expectException = true) {
        try {
            suspendWithException(Exception("OK"))
        } catch (e: RuntimeException) {
            suspendWithValue("fail")
            throw RuntimeException("fail 3")
        } finally {
            suspendWithValue("ignored 3")
            wasCalled = true
        }
    }

Response:
builder(expectException = true) {
        try {
            suspendWithException(Exception("OK"))
        } catch (e: RuntimeException) {
            suspendWithValue("fail")
            return@builder "xyz"
        } finally {
            suspendWithValue("ignored 4")
            wasCalled = true
        }
    }

    builder {
        try {<|endoftext|>


Prompt:
val file = moduleRoot.findChild(if (useSig) PsiJavaModule.MODULE_INFO_CLASS + ".sig" else PsiJavaModule.MODULE_INFO_CLS_FILE)
            ?: return null
        val moduleInfo = JavaModuleInfo.read(file, javaFileManager, allScope) ?: return null
        return systemModulesCache.getOrPut(moduleInfo.moduleName) {

Response:
JavaModule.Explicit(
                moduleInfo,
                when {
                    useLastJdkApi -> listOf(JavaModule.Root(moduleRoot, isBinary = true, isBinarySignature = useSig))
                    useSig -> createModuleFromSignature(moduleInfo)
                    else -> error("Can't find ${moduleRoot.path} module")
                },<|endoftext|>


Prompt:
// CHECK-OPT-NOT: Foo#toString(){}kotlin.String"
// CHECK-OPT: call %struct.ObjHeader* @Kotlin_String_plusImpl
// CHECK-OPT-NOT: kfun:kotlin.String#plus(kotlin.Any?)

// CHECK: ret %struct.ObjHeader*

Response:
fun manualPlusMemberAny(str: String, maybeAny: kotlin.Any?): kotlin.String =
    str + maybeAny

// CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_plus_member#manualPlusMemberString<|endoftext|>


Prompt:
if (!METHOD_OF_ANY_NAMES.contains(member.name.asString())) return false
            if (member.modality == Modality.ABSTRACT) return false

            return isImplementingMethodOfAnyInternal(member, HashSet<ClassDescriptor>())
        }

        private fun isImplementingMethodOfAnyInternal(
            member: CallableMemberDescriptor,

Response:
visitedClasses: MutableSet<ClassDescriptor>
        ): Boolean {
            for (overridden in member.overriddenDescriptors) {
                val containingDeclaration = overridden.containingDeclaration
                if (containingDeclaration !is ClassDescriptor) continue
                if (visitedClasses.contains(containingDeclaration)) continue<|endoftext|>


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

fun testR1xE6() {
    // with possible local optimizations
    if (0 in emptyCollection.indices != range1.contains(0)) throw AssertionError()

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


Prompt:
TODO("Not yet implemented")
            }
        },
        ENTRY2() {
            override fun abstractFunc() {
                TODO("Not yet implemented")
            }
        };

        constructor(arg: UserKlass = UserKlass()) : this(arg, UserKlass())
        constructor() : this(UserKlass(), UserKlass())

        abstract fun abstractFunc()

Response:
}

    enum class EnumerationCAA {
        ENTRY;

        constructor()
    }

    enum class EnumerationCAB {
        ENTRY1,
        ENTRY2;

        constructor()
    }

    enum class EnumerationCAC {
        ENTRY1,
        ENTRY2();

        constructor()
    }<|endoftext|>


Prompt:
val producer = rootProject.createSubproject(
            "producer",
            resolutionStrategy = strategy,
        ) {
            kotlin { producerTarget() }
        }
        val consumer = rootProject.createSubproject(
            "consumer",
            resolutionStrategy = strategy,
        ) {
            kotlin {
                consumerTarget()
                sourceSets.commonMain {
                    dependencies {

Response:
dependencyScope()(project(":${producer.name}"))
                    }
                }
            }
        }

        listOf(rootProject, producer, consumer).forEach { it.evaluate() }
        producer.publishFakeResources(producer.multiplatformExtension.producerTarget())

        assert(consumer, producer)
    }

    private fun testTransitiveDependencyOnResourcesProducer(<|endoftext|>