Prompt:
contextReceiver.customLabelName,
    builder.token
)

internal fun FirCallableSymbol<*>.getCallableIdIfNonLocal(): CallableId? {
    return when {
        origin == FirDeclarationOrigin.DynamicScope -> null
        callableId.isLocal -> null
        else -> callableId
    }
}

Response:
internal fun FirClassLikeSymbol<*>.getClassIdIfNonLocal(): ClassId? =
    classId.takeUnless { it.isLocal }

internal fun FirCallableSymbol<*>.dispatchReceiverType(
    builder: KtSymbolByFirBuilder,
): KtType? {
    val type = if (
        origin == FirDeclarationOrigin.DynamicScope<|endoftext|>


Prompt:
"Unexpected typeArgument: $typeArgument, ${typeArgument.javaClass.canonicalName}"
                }
            }
        }
    }

    fun TypeParameterDescriptor.shouldBeFlexible(flexibleCheck: (KotlinType) -> Boolean = { it.isFlexible() }): Boolean {
        return upperBounds.any {

Response:
flexibleCheck(it) || ((it.constructor.declarationDescriptor as? TypeParameterDescriptor)?.run { shouldBeFlexible() } ?: false)
        }
    }

    private fun getTypePreservingFlexibilityWrtTypeVariable(
        type: KotlinType,
        typeVariable: TypeVariableFromCallableDescriptor
    ): KotlinType {<|endoftext|>


Prompt:
super.areEqualTypeConstructors(c1, c2)
            }
        }

        return areCompatibleTypes(
            a, b,
            typeSystemContext = typeSystemContext,
            kotlinTypeRefiner = KotlinTypeRefiner.Default,
        )
    }

    private fun areCompatibleTypes(
        a: KotlinType,
        b: KotlinType,

Response:
typeSystemContext: ClassicTypeSystemContext,
        kotlinTypeRefiner: KotlinTypeRefiner,
    ): Boolean {
        with(NewKotlinTypeCheckerImpl(kotlinTypeRefiner)) {
            return createClassicTypeCheckerState(
                isErrorTypeEqualsToAnything = false,
                typeSystemContext = typeSystemContext,
                kotlinTypeRefiner = kotlinTypeRefiner,<|endoftext|>


Prompt:
CXAvailabilityKind.CXAvailability_NotAccessible -> false
    }

    // Skip functions which parameter or return type is TemplateRef
    protected open fun isFuncDeclEligible(cursor: CValue<CXCursor>): Boolean {
        var ret = true
        visitChildren(cursor) { childCursor, _ ->
            when (childCursor.kind) {

Response:
CXCursorKind.CXCursor_TemplateRef -> {
                    ret = false
                    CXChildVisitResult.CXChildVisit_Break
                }
                else -> CXChildVisitResult.CXChildVisit_Recurse
            }
        }
        return ret
    }

    private fun getFunctionParameters(cursor: CValue<CXCursor>): List<Parameter>? {<|endoftext|>


Prompt:
}
    }

    private fun KtAnalysisSession.renderScopeMembers(
        scope: KtScope,
        printer: PrettyPrinter,
        printPretty: Boolean,
        additionalSymbolInfo: KtAnalysisSession.(KtSymbol) -> String?,
    ) {
        fun <T : KtSymbol> List<T>.renderAll(
            symbolKind: String,

Response:
renderPrettySymbol: KtAnalysisSession.(T) -> String,
        ) = with(printer) {
            appendLine("$symbolKind: $size")
            withIndent {
                forEach {
                    appendLine(
                        if (printPretty) {
                            this@KtAnalysisSession.renderPrettySymbol(it)
                        } else {
                            debugRenderer.render(analysisSession, it)<|endoftext|>


Prompt:
if (!(x !is Class.NestedClass?) != false == true) {
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & Class.NestedClass?")!>x<!>
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & Class.NestedClass?")!>x<!>?.prop_4
    }
}

Response:
// TESTCASE NUMBER: 6
fun case_6(x: Any?) {
    if (!(x !is Object) != false != false != false) {
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & Object")!>x<!>
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & Object")!>x<!>.prop_1<|endoftext|>


Prompt:
for (platformDir in platformDirs) {
            if (platformDir.isDirectory) {
                bases.add(platformDir.absolutePath)
            }
        }
        if (bases.isEmpty()) {
            bases.add(moduleSourceDir.absolutePath)
        }
        put(CommonConfigurationKeys.KLIB_RELATIVE_PATH_BASES, bases)
    }

Response:
private inner class ProjectStepsExecutor(
        private val projectInfo: ProjectInfo,
        private val moduleInfos: Map<String, ModuleInfo>,
        private val testDir: File,
        private val sourceDir: File,
        private val buildDir: File,
        private val jsDir: File,
    ) {
        private inner class TestStepInfo(
            val moduleName: String,<|endoftext|>


Prompt:
if (parent is KtCallableReferenceExpression && expression == parent.callableReference) {
                return CALLABLE_REFERENCE(parent.receiverExpression)
            }

            val receiverExpression = expression.getReceiverExpression()

            if (expression.isImportDirectiveExpression()) {
                return IMPORT_DIRECTIVE(receiverExpression)
            }

Response:
if (expression.isPackageDirectiveExpression()) {
                return PACKAGE_DIRECTIVE(receiverExpression)
            }

            if (parent is KtUserType) {
                val constructorCallee = (parent.parent as? KtTypeReference)?.parent as? KtConstructorCalleeExpression<|endoftext|>


Prompt:
private var transformationInfo: TransformationInfo? = null
            private var currentLabel: Label? = null

            override fun visitLabel(label: Label?) {
                currentLabel = label
                super.visitLabel(label)
            }

            override fun visitLineNumber(line: Int, start: Label) {
                if (!isInlineOnlyMethod) {
                    currentLineNumber = line
                }

Response:
super.visitLineNumber(line, start)
            }

            private fun handleAnonymousObjectRegeneration() {
                transformationInfo = iterator.next()

                val oldClassName = transformationInfo!!.oldClassName
                if (inliningContext.parent?.transformationInfo?.oldClassName == oldClassName) {
                    // Object constructs itself, don't enter an infinite recursion of regeneration.<|endoftext|>


Prompt:
val callee = expression.symbol.owner
        return callee.valueParameters.size == 1 &&
                callee.extensionReceiverParameter?.type?.isSubtypeOfClass(context.ir.symbols.comparable) == true &&
                callee.kotlinFqName == FqName("kotlin.ranges.${OperatorNameConventions.RANGE_TO}")

Response:
}

    override fun build(expression: IrCall, data: Nothing?, scopeOwner: IrSymbol) =
        ComparableRangeInfo(
            start = expression.extensionReceiver!!,
            endInclusive = expression.getValueArgument(0)!!
        )
}<|endoftext|>


Prompt:
// MODULE: m1-common
// FILE: common.kt

expect class Foo1
expect class Foo2
expect class Foo3

<!EXPECT_ACTUAL_INCOMPATIBILITY{JVM}!>expect class Bar1<!EXPECT_ACTUAL_MISMATCH{JVM}!>()<!><!>

Response:
<!EXPECT_ACTUAL_INCOMPATIBILITY{JVM}!>expect class Bar2<!EXPECT_ACTUAL_MISMATCH{JVM}!>()<!><!>
<!EXPECT_ACTUAL_INCOMPATIBILITY{JVM}!>expect class Bar3<!EXPECT_ACTUAL_MISMATCH{JVM}!>()<!><!><|endoftext|>


Prompt:
* [build cache](https://docs.gradle.org/current/userguide/build_cache.html) with the same JDK version.
 */
interface KotlinJavaToolchain {

    /**
     * The configured JVM toolchain [JavaVersion].
     *
     * This property represents the configured JVM toolchain [JavaVersion] used for the task.

Response:
* If the toolchain is not explicitly set, it defaults to the version of the JDK that Gradle is currently running.
     */
    @get:Input
    val javaVersion: Provider<JavaVersion>

    /**
     * Provides access to the [JdkSetter] to configure the JVM toolchain for the task using an explicit JDK location.
     */
    @get:Internal<|endoftext|>


Prompt:
(spread is IrFunctionAccessExpression && spread.symbol == builder.irSymbols.arrayOfNulls))
            return spread

        return builder.irBlock {
            val spreadVar = if (spread is IrGetValue) spread.symbol.owner else irTemporary(spread)
            val size = unwrappedArrayType.classOrNull!!.getPropertyGetter("size")!!

Response:
val arrayCopyOf = builder.irSymbols.getArraysCopyOfFunction(unwrappedArrayType as IrSimpleType)
            // TODO consider using System.arraycopy if the requested array type is non-generic.
            +irCall(arrayCopyOf).apply {
                putValueArgument(0, coerce(irGet(spreadVar), unwrappedArrayType))<|endoftext|>


Prompt:
* Resolve owner of the call with special handling of Any methods:
     * if toString/eq/hc is invoked on an interface instance, we resolve
     * owner as Any and dispatch it via vtable.
     * Note: Keep on par with DFG builder.
     */
    val anyMethod = irFunction.findOverriddenMethodOfAny()

    return getVirtualFunctionTrampolineImpl(anyMethod ?: irFunction)

Response:
}

private fun CodeGenerator.getVirtualFunctionTrampolineImpl(irFunction: IrSimpleFunction) =
        generationState.virtualFunctionTrampolines.getOrPut(irFunction) {
            val targetName = if (irFunction.isExported())
                irFunction.computeSymbolName()
            else<|endoftext|>


Prompt: // library.kt:18 box: xFoo$iv:int=1:int, $i$f$foo:int=0:int, xBar1\1$iv:int=0:int, xBar2\1$iv:int=1:int, xBar3\1$iv:int=2:int, $i$f$bar\1\6:int=0:int,

Response: xBaz1\2$iv:int=100:int, xBaz2\2$iv:int=101:int, xBaz3\2$iv:int=102:int, $i$f$baz\2\31:int=0:int<|endoftext|>


Prompt:
913, 788, 837, 913, 787, 768, 837, 913, 788, 768, 837, 913, 787, 769, 837, 913,
    788, 769, 837, 913, 787, 834, 837, 913, 788, 834, 837, 951, 787, 837, 951, 788,

Response:
837, 951, 787, 768, 837, 951, 788, 768, 837, 951, 787, 769, 837, 951, 788, 769,
    837, 951, 787, 834, 837, 951, 788, 834, 837, 919, 787, 837, 919, 788, 837, 919,<|endoftext|>


Prompt:
@JvmField
        val KOTLIN_1_1 = createByLanguageVersion(LanguageVersion.KOTLIN_1_1)

        @JvmField
        val KOTLIN_1_2 = createByLanguageVersion(LanguageVersion.KOTLIN_1_2)

        @JvmField

Response:
val KOTLIN_1_3 = createByLanguageVersion(LanguageVersion.KOTLIN_1_3)

        @JvmField
        val KOTLIN_1_4 = createByLanguageVersion(LanguageVersion.KOTLIN_1_4)

        @JvmField
        val KOTLIN_1_5 = createByLanguageVersion(LanguageVersion.KOTLIN_1_5)<|endoftext|>


Prompt:
f(r)
    r
    require(B("3") == B(3U))
    C(2, B(3U), "")
    D(C(2, B(3U), ""))
    val x = D(C(2, B(3U), ""))
    var y = D(C(4, B(5U), "1"))
    supply(y)

Response:
y = D(C(6, B(7U), "2"))
    y = D(6, 7U, 2)
    y = inlined(6, 7U, 2)
    y = notInlined(6, 7U, 2)
    supply(y)
}

fun h1() {
    var y = inlined(1, 2U, 3) // todo fix box<|endoftext|>


Prompt:
total += A488.a
    total += A489.a
    total += A490.a
    total += A491.a
    total += A492.a
    total += A493.a
    total += A494.a
    total += A495.a
    total += A496.a
    total += A497.a
    total += A498.a
    total += A499.a

Response:
return total
}

private object B0 { val a = Random.nextInt(100) }
private object B1 { val a = B0.a + Random.nextInt(100) }
private object B2 { val a = B1.a + Random.nextInt(100) }
private object B3 { val a = B2.a + Random.nextInt(100) }<|endoftext|>


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

@Ann
expect class AnnotationMatching

@Ann
expect class AnnotationOnExpectOnly

expect class AnnotationOnActualOnly

expect class AnnotationInside {
    @Ann
    fun matches()

    @Ann
    fun onlyOnExpect()

    fun onlyOnActual()
}

Response:
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
@Ann
actual class AnnotationMatching

actual class <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>AnnotationOnExpectOnly<!>

@Ann
actual class AnnotationOnActualOnly

actual class AnnotationInside {
    @Ann
    actual fun matches() {}<|endoftext|>


Prompt:
import java.nio.file.Files

val ModuleKind.extension: String
    get() = when (this) {
        ModuleKind.ES -> ESM_EXTENSION
        else -> REGULAR_EXTENSION
    }

enum class TsCompilationStrategy {
    NONE,
    MERGED,
    EACH_FILE
}

abstract class CompilationOutputs {

Response:
var dependencies: Collection<Pair<String, CompilationOutputs>> = emptyList()

    abstract val tsDefinitions: TypeScriptFragment?

    abstract val jsProgram: JsProgram?

    abstract fun writeJsCode(outputJsFile: File, outputJsMapFile: File)<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char? & kotlin.Char")!>x<!>.equals(null)
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char? & kotlin.Char")!>x<!>.propT

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char? & kotlin.Char")!>x<!>.propAny
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char? & kotlin.Char")!>x<!>.propNullableT<|endoftext|>


Prompt:
propertyCache.synthetic.values.forEachWithRemapping(symbolsMappingForLazyClasses::remapPropertySymbol, block)
        getterForPropertyCache.values.forEachWithRemapping(symbolsMappingForLazyClasses::remapFunctionSymbol, block)

Response:
setterForPropertyCache.values.forEachWithRemapping(symbolsMappingForLazyClasses::remapFunctionSymbol, block)
        backingFieldForPropertyCache.values.forEach(block)
        propertyForBackingFieldCache.values.forEach(block)
        delegateVariableForPropertyCache.values.forEach(block)
    }<|endoftext|>


Prompt:
override fun build(): FirAnonymousFunction {
        return FirAnonymousFunctionImpl(
            source,
            resolvePhase,
            annotations.toMutableOrEmpty(),
            moduleData,
            origin,
            attributes,
            status,
            returnTypeRef,
            receiverParameter,
            deprecationsProvider,
            containerSource,
            dispatchReceiverType,

Response:
contextReceivers.toMutableOrEmpty(),
            controlFlowGraphReference,
            valueParameters,
            body,
            contractDescription,
            symbol,
            label,
            invocationKind,
            inlineStatus,
            isLambda,
            hasExplicitParameterList,
            typeParameters,
            typeRef,
        )
    }

}<|endoftext|>


Prompt:
if (f != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>f<!>.propNullableT

        if (f != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>f<!>.propNullableAny

Response:
if (f != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>f<!>.funT()

        if (f != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>f<!>.funAny()<|endoftext|>


Prompt:
// test.kt:16 box
// test.kt:17 box
// test.kt:13 box

// EXPECTATIONS JS_IR
// test.kt:4 box
// test.kt:6 box
// test.kt:9 box
// test.kt:11 box
// test.kt:13 box

// EXPECTATIONS WASM
// test.kt:4 $box (12, 4)

Response:
// test.kt:5 $box
// test.kt:16 $box (4, 4)
// test.kt:6 $box (12, 8)
// test.kt:9 $box
// test.kt:8 $box
// test.kt:10 $box
// test.kt:11 $box (12, 8)
// test.kt:13 $box<|endoftext|>


Prompt:
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.diagnostics.reportDiagnosticOnce
import org.jetbrains.kotlin.diagnostics.reportDiagnosticOnceWrtDiagnosticFactoryList

Response:
import org.jetbrains.kotlin.psi.KtNameReferenceExpression
import org.jetbrains.kotlin.psi.KtParameter
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.calls.SPECIAL_FUNCTION_NAMES<|endoftext|>


Prompt:
* @sample samples.collections.Arrays.CopyOfOperations.copyOf
 */
public actual fun LongArray.copyOf(): LongArray {
    return this.copyOfUninitializedElements(size)
}

/**
 * Returns new array which is a copy of the original array.
 *
 * @sample samples.collections.Arrays.CopyOfOperations.copyOf
 */

Response:
public actual fun FloatArray.copyOf(): FloatArray {
    return this.copyOfUninitializedElements(size)
}

/**
 * Returns new array which is a copy of the original array.
 *
 * @sample samples.collections.Arrays.CopyOfOperations.copyOf
 */
public actual fun DoubleArray.copyOf(): DoubleArray {
    return this.copyOfUninitializedElements(size)
}<|endoftext|>


Prompt:
fun generatedTopLevelFunction1(): GeneratedClass2

// FILE: extension2.kt
// RESOLVE_EXTENSION_FILE
package generated

// RESOLVE_EXTENSION_CLASSIFIER: GeneratedClass2
class GeneratedClass2 {
    fun generatedClassMember2(): GeneratedClass1
}

// FILE: main.kt
import generated.*

fun main() {

Response:
generatedTopLevelFunc<caret>tion1()
}<|endoftext|>


Prompt:
val FirResolvePhase.isBodyResolve: Boolean
    get() = when (this) {
        FirResolvePhase.BODY_RESOLVE,
        FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE -> true
        else -> false
    }

/**
 * See [FirResolvePhase] KDoc for more details about resolution contacts.
 *

Response:
* @param this The current phase
 * @param requestedPhase The requested phase
 *
 * @see FirResolvePhase
 * @see org.jetbrains.kotlin.fir.symbols.FirLazyDeclarationResolver
 * @see org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase<|endoftext|>


Prompt:
|tasks.named("jar", Jar) {
                |   duplicatesStrategy = DuplicatesStrategy.INCLUDE
                |}
                |
                |sourceSets.main.resources.srcDir "src/main/extra-resources"
                |
                |apply plugin: 'org.jetbrains.kotlin.jvm'
                |
                """.trimMargin()
            )

Response:
build("jar") {
                assertFileInProjectExists("build/libs/simpleProject.jar")
                projectPath.resolve("build/libs/simpleProject.jar").assertZipArchiveContainsFilesOnce(
                    listOf(mainResFile.name, additionalResFile.name)
                )
            }
        }
    }

    @GradleTest<|endoftext|>


Prompt:
override fun categoryId(categoryCode: String): String = when (categoryCode) {
        CharCategory.NON_SPACING_MARK.code,
        CharCategory.ENCLOSING_MARK.code,
        CharCategory.FORMAT.code,
        CharCategory.MODIFIER_LETTER.code,
        CharCategory.MODIFIER_SYMBOL.code -> id
        else -> "Else"

Response:
}

    override fun shouldSkip(categoryId: String): Boolean {
        return categoryId != id
    }
}<|endoftext|>


Prompt:
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""

        class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
            <!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
        }
        <!CONFLICTING_OVERLOADS!>fun Test5()<!> {}

Response:
<!CONFLICTING_OVERLOADS!>fun Test5(x: Int)<!> = x

        return 0
    }
}

val obj = object {
    fun test() {
        <!CONFLICTING_OVERLOADS!>fun test1()<!> {}
        <!CONFLICTING_OVERLOADS!>fun test1()<!> {}<|endoftext|>


Prompt: // library.kt:48 box: $i$f$foo\1\64:int=0:int, array\1:java.lang.Integer[]=java.lang.Integer[], myClass\1:MyClass=MyClass

Response: // library.kt:56 box: $i$f$foo\1\64:int=0:int, array\1:java.lang.Integer[]=java.lang.Integer[], myClass\1:MyClass=MyClass, $i$f$test\38\476:int=0:int<|endoftext|>


Prompt:
* Accumulates value starting with the first element and applying [operation] from left to right
 * to current accumulator value and each element with its index in the original array.
 *
 * Returns `null` if the array is empty.
 *
 * @param [operation] function that takes the index of an element, current accumulator value and the element itself,
 * and calculates the next accumulator value.
 *

Response:
* @sample samples.collections.Collections.Aggregates.reduceOrNull
 */
@SinceKotlin("1.4")
public inline fun DoubleArray.reduceIndexedOrNull(operation: (index: Int, acc: Double, Double) -> Double): Double? {
    if (isEmpty())
        return null
    var accumulator = this[0]
    for (index in 1..lastIndex) {<|endoftext|>


Prompt:
fun getAbiTypes() = abiTypes.filter { !toIgnore.contains(it) && it != classInternalName }.toSet()
    fun getPrivateTypes() = privateTypes.filter { !toIgnore.contains(it) && it != classInternalName && !abiTypes.contains(it) }.toSet()

Response:
override fun visit(version: Int, access: Int, name: String?, signature: String?, superName: String?, interfaces: Array<out String>?) {
        super.visit(version, access, name, signature, superName, interfaces)
        classInternalName = name!!
        superName?.let {
            abiTypes.add(it)
        }
        interfaces?.let {<|endoftext|>


Prompt:
replaceEmptyParameterWithEmptyArray(expression)
                return expression
            }

            override fun visitVararg(expression: IrVararg): IrExpression {
                expression.transformChildrenVoid(transformer)

                val hasSpreadElement = hasSpreadElement(expression)
                val type = expression.varargElementType
                val arrayHandle = arrayType(expression.type)

Response:
val irBuilder = context.createIrBuilder(owner, expression.startOffset, expression.endOffset)
                val isConstantVararg = expression.elements.all {
                    it is IrConst<*> || it is IrConstantValue
                }
                if (isConstantVararg) {
                    return irBuilder.irCall(
                            arrayHandle.copyOfSymbol,
                    ).apply {<|endoftext|>


Prompt:
o6.c()
        o6.i1()
        o6.i2()
        o7.c()
        o7.i1()
        o7.i2()
        o8.g()
        o9.g()
        o9.i1()
        o9.i2()
        o10.g()
        o10.i1()
        o10.i2()

Response:
}
}<|endoftext|>


Prompt:
val interopCreateObjCObjectHolder = interopFunction("createObjCObjectHolder")

    val interopCreateKotlinObjectHolder = interopFunction("createKotlinObjectHolder")
    val interopUnwrapKotlinObjectHolderImpl = interopFunction("unwrapKotlinObjectHolderImpl")

    val interopCreateObjCSuperStruct = interopFunction("createObjCSuperStruct")

Response:
val interopGetMessenger = interopFunction("getMessenger")
    val interopGetMessengerStret = interopFunction("getMessengerStret")

    val interopGetObjCClass = interopFunction(InteropFqNames.getObjCClassFunName)
    val interopObjCObjectSuperInitCheck = interopFunction(InteropFqNames.objCObjectSuperInitCheckFunName)<|endoftext|>


Prompt:
.associateBy { it.versionNumber }

            val abiSignatureVersion = library.versions.irSignatureVersions
                    .map { it.number }
                    .sortedDescending()
                    .firstNotNullOfOrNull { versionsSupportedByAbiReader[it] }

            if (abiSignatureVersion == null) {
                output.logError(

Response:
"There is no signature version that would be both supported in library ${library.libraryFile}" +
                                " and by the KLIB ABI reader. Supported versions in the library:" +
                                " ${library.versions.irSignatureVersions.joinToString { it.number.toString() }}" +<|endoftext|>


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

import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeOwner
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
import org.jetbrains.kotlin.name.FqName

Response:
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.KtFile

public abstract class KtImportOptimizer : KtLifetimeOwner {
    public abstract fun analyseImports(file: KtFile): KtImportOptimizerResult
}

public interface KtImportOptimizerMixIn : KtAnalysisSessionMixIn {

    /**<|endoftext|>


Prompt:
if (a.b !== null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float & kotlin.Float?")!>a.b<!>.propNullableAny
    if (a.b !== null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float"), DEBUG_INFO_SMARTCAST!>a.b<!>.funT()

Response:
if (a.b !== null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float"), DEBUG_INFO_SMARTCAST!>a.b<!>.funAny()
    if (a.b !== null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float & kotlin.Float?")!>a.b<!>.funNullableT()<|endoftext|>


Prompt:
diagnostic = ConeSimpleDiagnostic("empty body", DiagnosticKind.Other)
                }
            result.transformReturnTypeRef(transformer, withExpectedType(returnTypeRef))
        }

        return result
    }

    override fun transformFunction(
        function: FirFunction,
        data: ResolutionMode
    ): FirFunction {
        if (function.bodyResolved) return function

Response:
return transformFunction(function, data, shouldResolveEverything = true)
    }

    private fun transformFunction(
        function: FirFunction,
        data: ResolutionMode,
        shouldResolveEverything: Boolean,
    ): FirFunction = whileAnalysing(session, function) {
        val bodyResolved = function.bodyResolved
        dataFlowAnalyzer.enterFunction(function)<|endoftext|>


Prompt:
private fun createFileStub(project: Project, text: String): PsiFileStub<*> {
        val virtualFile = LightVirtualFile("dummy.kt", KotlinFileType.INSTANCE, text)
        virtualFile.language = KotlinLanguage.INSTANCE
        SingleRootFileViewProvider.doNotCheckFileSizeLimit(virtualFile)

Response:
val psiFileFactory = PsiFileFactory.getInstance(project) as PsiFileFactoryImpl
        val file = psiFileFactory.trySetupPsiForFile(virtualFile, KotlinLanguage.INSTANCE, false, false)!!
        return KtFileElementType.INSTANCE.builder.buildStubTree(file) as PsiFileStub<*>
    }
}<|endoftext|>


Prompt:
prerequisite = setOf(localClassesInInlineFunctionsPhase)
)

private val wrapInlineDeclarationsWithReifiedTypeParametersPhase = makeIrModulePhase(
    ::WrapInlineDeclarationsWithReifiedTypeParametersLowering,
    name = "WrapInlineDeclarationsWithReifiedTypeParametersPhase",
    description = "Wrap inline declarations with reified type parameters"
)

Response:
private val functionInliningPhase = makeIrModulePhase(
    ::WasmFunctionInlining,
    name = "FunctionInliningPhase",
    description = "Perform function inlining",
    prerequisite = setOf(
        expectDeclarationsRemovingPhase,
        wrapInlineDeclarationsWithReifiedTypeParametersPhase,
        localClassesInInlineLambdasPhase,<|endoftext|>


Prompt:
val version = json.nextString()
            if (version != this.version) return null

            check(json.nextName() == "items")
            json.obj {
                while (json.peek() == JsonToken.NAME) {
                    val key = json.nextName()
                    json.beginObject()
                    check(json.nextName() == "src")
                    val src = json.nextString()

Response:
var target: String? = null
                    if (json.peek() == JsonToken.NAME) {
                        check(json.nextName() == "target")
                        if (json.peek() != JsonToken.NULL) {
                            target = json.nextString()
                        }
                    }
                    json.endObject()

                    result[decodeHexString(key)] = Element(src, target)<|endoftext|>


Prompt:
* HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses
 */

/*
 * TESTCASE NUMBER: 1
 * UNEXPECTED BEHAVIOUR
 * ISSUES: KT-28759
 */
fun case_1() {
    val x: Int? = 10
    val y: Int?
    y = x
    if (y != null) {

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.inv()
    }
}

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


Prompt:
"авторемонтник",
"авторемонтный",
"автореферат",
"авторефрижератор",
"авторизация",

Response:
"авторизованный",
"авторизовать",
"авторитарность",
"авторитарный",
"авторитет",
"авторитетность",<|endoftext|>


Prompt:
private fun getRealParent(variable: IrVariable) =
                    variable.parent.let { skippedFunctionsParents[it] ?: it }

            }, irDeclaration as? IrDeclarationParent ?: irDeclaration.parent)
        }

        private fun rewriteSharedVariables() {
            val transformedSymbols = HashMap<IrValueSymbol, IrVariableSymbol>()

Response:
irBody.transformChildrenVoid(object : IrElementTransformerVoid() {
                override fun visitVariable(declaration: IrVariable): IrStatement {
                    declaration.transformChildrenVoid(this)

                    if (declaration !in sharedVariables) return declaration

                    val newDeclaration = context.sharedVariablesManager.declareSharedVariable(declaration)
                    newDeclaration.parent = declaration.parent<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.FirPureAbstractElement
import org.jetbrains.kotlin.fir.visitors.FirTransformer
import org.jetbrains.kotlin.fir.visitors.FirVisitor

/**
 * Generated from: [org.jetbrains.kotlin.fir.tree.generator.FirTreeBuilder.reference]

Response:
*/
abstract class FirReference : FirPureAbstractElement(), FirElement {
    abstract override val source: KtSourceElement?

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

    @Suppress("UNCHECKED_CAST")<|endoftext|>


Prompt:
private val descriptorMetadataMap: MutableMap<ClassDescriptor, SerializableProperties> = hashMapOf()

    private val ClassDescriptor.needSaveProgramOrder: Boolean
        get() = isInternalSerializable && (modality == Modality.OPEN || modality == Modality.ABSTRACT)

Response:
internal fun putIfNeeded(descriptor: ClassDescriptor, properties: SerializableProperties) {
        if (!descriptor.needSaveProgramOrder) return
        descriptorMetadataMap[descriptor] = properties
    }

    override fun afterClass(
        descriptor: ClassDescriptor,
        proto: ProtoBuf.Class.Builder,<|endoftext|>


Prompt:
return ReceiverParameterDescriptorImpl(owner, TransientReceiver(dynamicType), Annotations.EMPTY)
    }

    private fun createTypeParameters(owner: DeclarationDescriptor, call: Call): List<TypeParameterDescriptor> =
        call.typeArguments.indices.map { index
            ->
            TypeParameterDescriptorImpl.createWithDefaultBound(
                owner,

Response:
Annotations.EMPTY,
                false,
                Variance.INVARIANT,
                Name.identifier("T$index"),
                index,
                storageManager
            )
        }

    private fun createValueParameters(owner: FunctionDescriptor, call: Call): List<ValueParameterDescriptor> {
        val parameters = ArrayList<ValueParameterDescriptor>()<|endoftext|>


Prompt:
val LLVMValueRef.isConst:Boolean
    get() = (LLVMIsConstant(this) == 1)

internal inline fun generateFunction(
        codegen: CodeGenerator,
        function: IrFunction,
        startLocation: LocationInfo?,
        endLocation: LocationInfo?,
        code: FunctionGenerationContext.() -> Unit
) {

Response:
val llvmFunction = codegen.llvmFunction(function)

    val isCToKotlinBridge = function.origin == CBridgeOrigin.C_TO_KOTLIN_BRIDGE
            // TODO: Alternative approach: lowering that changes origin of such functions to C_TO_KOTLIN_BRIDGE?
            || function.hasAnnotation(RuntimeNames.exportedBridge)<|endoftext|>


Prompt:
const val plus7 = twoVal.<!EVALUATED("4.0")!>plus(longVal)<!>
const val plus8 = twoVal.<!EVALUATED("4.0")!>plus(floatVal)<!>

const val minus1 = oneVal.<!EVALUATED("-1.0")!>minus(twoVal)<!>

Response:
const val minus2 = twoVal.<!EVALUATED("0.0")!>minus(twoVal)<!>
const val minus3 = threeVal.<!EVALUATED("1.0")!>minus(twoVal)<!>
const val minus4 = twoVal.<!EVALUATED("0.0")!>minus(byteVal)<!><|endoftext|>


Prompt:
* General category "So" in the Unicode specification.
     */
    OTHER_SYMBOL,

    /**
     * General category "Pi" in the Unicode specification.
     */
    INITIAL_QUOTE_PUNCTUATION,

    /**
     * General category "Pf" in the Unicode specification.
     */
    FINAL_QUOTE_PUNCTUATION;

    /**

Response:
* Two-letter code of this general category in the Unicode specification.
     */
    public val code: String

    /**
     * Returns `true` if [char] character belongs to this category.
     */
    public operator fun contains(char: Char): Boolean
}<|endoftext|>


Prompt:
val c = Node("c")
        val d = Node("d")
        val e = Node("e")
        val f = Node("f")
        val g = Node("g")

        // a -> (b, c)
        // c -> (d)
        a.children.add(b)
        a.children.add(c)
        c.children.add(d)

Response:
// e -> (f, g, a)
        e.children.add(f)
        e.children.add(g)
        e.children.add(a) // <- cycle back to a!

        assertEquals(
            listOf("b", "c", "f", "g", "d"), // <- a *is not* listed in closure!!!<|endoftext|>


Prompt:
fun get(): List<KClass<*>>
}

class GetScriptClassForImplicits(
    private val previousScriptClassesProvider: PreviousScriptClassesProvider
) : GetScriptingClassByClassLoader {
    private val getScriptingClass = JvmGetScriptingClass()

    private val lastClassLoader
        get() = previousScriptClassesProvider.get().lastOrNull()?.java?.classLoader

Response:
override fun invoke(
        classType: KotlinType,
        contextClass: KClass<*>,
        hostConfiguration: ScriptingHostConfiguration
    ): KClass<*> {
        return getScriptingClass(classType, lastClassLoader ?: contextClass.java.classLoader, hostConfiguration)
    }

    override fun invoke(
        classType: KotlinType,
        contextClassLoader: ClassLoader?,<|endoftext|>


Prompt:
<!OVERRIDE_BY_INLINE!>override inline final fun <<!REIFIED_TYPE_PARAMETER_IN_OVERRIDE!>reified<!> T> qux(x: T)<!> {}
    }

    val anObject = object : IBase {
        <!OVERRIDE_BY_INLINE!>override inline final fun foo()<!> {}

Response:
<!OVERRIDE_BY_INLINE!>override inline fun bar()<!> {}
        <!OVERRIDE_BY_INLINE!>override inline final fun <<!REIFIED_TYPE_PARAMETER_IN_OVERRIDE!>reified<!> T> qux(x: T)<!> {}
    }

    fun aMethod() {
        class CLocal : IBase {<|endoftext|>


Prompt:
return context.symbolTable.descriptorExtension.referenceSimpleFunction(descriptor)
    }

    private fun getFunctionInEnumPackage(name: String) =
        context.symbolTable.descriptorExtension.referenceSimpleFunction(
            context.getFunctions(kotlinEnumsPackageFqn.child(Name.identifier(name))).single()
        )

Response:
private fun getFunctionInKotlinPackage(name: String) =
        context.symbolTable.descriptorExtension.referenceSimpleFunction(
            context.getFunctions(kotlinPackageFqn.child(Name.identifier(name))).single()
        )

    private fun getInternalClassWithoutPackage(fqName: String) =<|endoftext|>


Prompt:
declarationRenderer.nameRenderer.renderName(analysisSession, symbol, declarationRenderer, printer)

                printer.printCollection(symbol.valueParameters, prefix = "(", postfix = ")") {
                    declarationRenderer.typeRenderer.renderType(analysisSession, it.returnType, printer)
                }

                withPrefix(": ") {

Response:
declarationRenderer.returnTypeRenderer
                        .renderReturnType(analysisSession, symbol, declarationRenderer, printer)
                }
            }
        }
    }
}<|endoftext|>


Prompt: public inline fun <R, V> kotlin.FloatArray.zip(other: kotlin.collections.Iterable<R>, transform: (a: kotlin.Float, b: R) -> V): kotlin.collections.List<V>

Response: public infix fun <R> kotlin.IntArray.zip(other: kotlin.Array<out R>): kotlin.collections.List<kotlin.Pair<kotlin.Int, R>><|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.services.PreAnalysisHandler
import org.jetbrains.kotlin.test.services.TestModuleStructure

Response:
import org.jetbrains.kotlin.test.services.TestServices

internal fun FirElement.renderWithClassName(): String =
    "${this::class.simpleName} `${render()}`"

internal fun FirBasedSymbol<*>.name(): String = when (this) {
    is FirCallableSymbol<*> -> callableId.callableName.asString()<|endoftext|>


Prompt:
public interface KtPossiblyNamedSymbol : KtSymbol {
    public val name: Name?
}

public interface KtNamedSymbol : KtPossiblyNamedSymbol {
    override val name: Name
}

public interface KtSymbolWithTypeParameters : KtSymbol {
    public val typeParameters: List<KtTypeParameterSymbol>
}

/**

Response:
* A marker interface for symbols which could potentially be `expect` or `actual`. For more details about `expect` and `actual`
 * declarations, see [documentation](https://kotlinlang.org/docs/multiplatform-connect-to-apis.html).
 */
public interface KtPossibleMultiplatformSymbol : KtSymbol {
    /**<|endoftext|>


Prompt:
val topLevelName = classifier.topLevelName
        if (topLevelName in alreadyDeclared) {
            throw IllegalStateException("'$topLevelName' is already declared")
        }
        alreadyDeclared.add(topLevelName)

        return topLevelName
    }

    override fun declareProperty(receiver: String?, name: String): String? {

Response:
val fullName = receiver?.let { "$it.${name}" } ?: name
        return if (fullName in declaredProperties || name in namesToBeDeclared || name in importedNameToPkg) {
            null
            // TODO: using original global name should be preferred to importing the clashed name.
        } else {
            declaredProperties.add(fullName)
            name
        }
    }<|endoftext|>


Prompt:
case405 checkType { check<Char>()}
}
// TESTCASE NUMBER: 406
fun case406(){
   val case406 = '\ucaff'
   <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char")!>case406<!>
   case406 checkType { check<Char>()}
}
// TESTCASE NUMBER: 407
fun case407(){

Response:
val case407 = '\ucb00'
   <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char")!>case407<!>
   case407 checkType { check<Char>()}
}
// TESTCASE NUMBER: 408
fun case408(){
   val case408 = '\ucbff'<|endoftext|>


Prompt:
expect(2) { arrayOf("cat", "dog", "bird").indexOf("bird") }
        expect(0) { arrayOf(null, "dog", null).indexOf(null as String?)}

        expect(-1) { arrayOf("cat", "dog", "bird").indexOfFirst { it.contains("p") } }

Response:
expect(0) { arrayOf("cat", "dog", "bird").indexOfFirst { it.startsWith('c') } }
        expect(1) { arrayOf("cat", "dog", "bird").indexOfFirst { it.startsWith('d') } }
        expect(2) { arrayOf("cat", "dog", "bird").indexOfFirst { it.endsWith('d') } }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.codegen.state.isMethodWithDeclarationSiteWildcardsFqName
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.ir.declarations.*

Response:
import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyClass
import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyFunctionBase
import org.jetbrains.kotlin.ir.declarations.lazy.IrMaybeDeserializedClass
import org.jetbrains.kotlin.ir.descriptors.IrBasedSimpleFunctionDescriptor<|endoftext|>


Prompt:
serializerDescriptor, SerialEntityNames.TYPE_PARAMS_SERIALIZERS_GETTER.identifier,
            { true }, { it.isEmpty() }
        )?.takeIf { it.kind != CallableMemberDescriptor.Kind.FAKE_OVERRIDE }?.let { generateTypeParamsSerializersGetter(it) }
    }

Response:
protected abstract fun generateTypeParamsSerializersGetter(function: FunctionDescriptor)

    protected abstract fun generateChildSerializersGetter(function: FunctionDescriptor)

    protected val generatedSerialDescPropertyDescriptor = getPropertyToGenerate(
        serializerDescriptor, SerialEntityNames.SERIAL_DESC_FIELD,
        serializerDescriptor::checkSerializableClassPropertyResult
    )<|endoftext|>


Prompt:
// Inputs and outputs.

    @OutputFile
    val outputFileProvider: Provider<File> = project.provider { destinationDir.get().resolve(outputFileName) }

    //Error file will be written only for errors during a project sync because for the sync task mustn't fail

Response:
//see: org.jetbrains.kotlin.gradle.targets.native.tasks.IdeaSyncKotlinNativeCInteropRunnerExecutionContext
    @get:OutputFile
    internal val errorFileProvider: Provider<File> = project.provider { destinationDir.get().resolve("cinterop_error.out") }

    init {
        //KTIJ-25563:<|endoftext|>


Prompt:
// with explicit type:
fun function1(): Int = 1
fun function2(): String = "hello"
fun function3(): Planet = Planet("Earth", 12742)
fun function4(): B = A("Earth", 12742)
fun function5(): Planet = A("Earth", 12742)
fun function6(): Planet = Planet("Earth", 12742)
fun function7(): C = C("Earth", 12742)

Response:
val propertyWithMismatchedType1: Long = 1
val propertyWithMismatchedType2: Short = 1
val propertyWithMismatchedType3: Number = 1
val propertyWithMismatchedType4: Comparable<Int> = 1
val propertyWithMismatchedType5: String = 1.toString()

fun functionWithMismatchedType1(): Long = 1
fun functionWithMismatchedType2(): Short = 1<|endoftext|>


Prompt:
open class Test {
    companion object {
        fun testStatic(ic: InnerClass): NotInnerClass = NotInnerClass(ic.value)
    }

    fun test(): InnerClass = InnerClass(150)

    inner open class InnerClass(val value: Int)
    open class NotInnerClass(val value: Int)
}

Response: fun box() = if (Test.testStatic(Test().test()).value == 150) "OK" else "FAIL"<|endoftext|>


Prompt:
*/

fun throwException(b: Boolean) = run { if (b) throw Exception() }

fun box(): String {
    var isTryExecuted = false
    var isCatched = false
    var isFinallyExecuted = false
    try {
        isTryExecuted = true
        throwException(true)
    } catch (e: Exception) {
        isCatched = true
    } finally {

Response:
isFinallyExecuted = true
    }
    return if (isTryExecuted &&isCatched && isFinallyExecuted) "OK"
    else "NOK"
}<|endoftext|>


Prompt:
const val d2 = <!EVALUATED: `Ivan <NULL>`!>Person("Ivan", 20).wholeName<!>

@CompileTimeCalculation
class A {
    val prop: Int
    constructor(arg: Boolean) {
        if (arg) {
            prop = 1
            return
        }
        prop = 2
    }
}

Response:
const val e1 = <!EVALUATED: `1`!>A(true).prop<!>
const val e2 = <!EVALUATED: `2`!>A(false).prop<!><|endoftext|>


Prompt:
//ALLOW_AST_ACCESS

package test

fun test1(): suspend () -> Unit = null!!
fun test1N(): (suspend () -> Unit)? = null
fun test2(): suspend Int.() -> Int = null!!
fun test2N(): (suspend Int.() -> Int)? = null
fun test3(): List<suspend () -> Unit> = null!!

Response:
fun test3N(): List<(suspend () -> Unit)?> = null!!
fun test4(): suspend () -> (suspend () -> Unit) = null!!
fun test4N(): (suspend () -> (suspend () -> Unit)?)? = null<|endoftext|>


Prompt:
// TARGET_BACKEND: JVM
// WITH_REFLECT

import kotlin.reflect.*
import kotlin.reflect.jvm.isAccessible
import kotlin.test.*

object Delegate {
    var storage = ""
    operator fun getValue(instance: Any?, property: KProperty<*>) = storage

Response:
operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value }
}

class Bar

class Foo {
    var Bar.result: String by Delegate
}

fun box(): String {
    val foo = Foo()
    val bar = Bar()
    with(foo) { bar.result = "Fail" }<|endoftext|>


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

Response:
* @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],
 * or when that index is out of the [destination] array indices range.
 *
 * @return the [destination] array.
 */
@SinceKotlin("1.3")
@kotlin.internal.InlineOnly<|endoftext|>


Prompt:
raised("a.a.B.failing.exception")
                call("a.a.B.after")
                caught("a.a.B.failing.exception")
            }
            test("ignored", true) {
                call("a.a.B.before")
                call("a.a.B.ignored")
                call("a.a.B.after")
            }

Response:
test("withException") {
                call("a.a.B.before")
                call("withException")
                raised("some exception")
                call("a.a.B.after")
                caught("some exception")
            }
            suite("Inner") {
                test("innerTest") {
                    call("a.a.B.Inner.innerTest")
                }
            }<|endoftext|>


Prompt:
assertConstraint(nativeSharedSourceSet, IdeMultiplatformImport.SourceSetConstraint.unconstrained, isMatchExpected = true)
        }

        for (nativeLeafSourceSet in listOf(linuxX64Main, linuxX64Test, linuxArm64Main, linuxArm64Test)) {

Response:
assertConstraint(nativeLeafSourceSet, IdeMultiplatformImport.SourceSetConstraint.isAndroid, isMatchExpected = false)
            assertConstraint(nativeLeafSourceSet, IdeMultiplatformImport.SourceSetConstraint.isJvmAndAndroid, isMatchExpected = false)<|endoftext|>


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

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

//Assignment after loop

fun test10() {

Response:
var x: Any? = materialize()
    require(x is String)
    for(i in 1..10) {
        x.length
    }
    x = ""
}

fun test11() {
    var x: Any? = materialize()
    require(x is String)
    for(i in 1..10) {
        x.length
    }
    x = 10
}<|endoftext|>


Prompt:
var found = false
    for (element in this) {
        if (predicate(element)) {
            if (found) throw IllegalArgumentException("Collection contains more than one matching element.")
            single = element
            found = true
        }
    }
    if (!found) throw NoSuchElementException("Collection contains no element matching the predicate.")
    @Suppress("UNCHECKED_CAST")
    return single as T

Response:
}

/**
 * Returns single element, or `null` if the collection is empty or has more than one element.
 */
public fun <T> Iterable<T>.singleOrNull(): T? {
    when (this) {
        is List -> return if (size == 1) this[0] else null
        else -> {
            val iterator = iterator()
            if (!iterator.hasNext())
                return null<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>v<!>.propAny
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>v<!>.propNullableT

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>v<!>.propNullableAny
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>v<!>.funT()<|endoftext|>


Prompt:
// running a watcher thread that ensures that if the daemon is not exited normally (may be due to RMI leftovers), it's forced to exit
                                                         timer.schedule(daemonOptions.forceShutdownTimeoutMilliseconds) {
                                                             cancel()
                                                             log.info("force JVM shutdown")
                                                             exitProcess(0)
                                                         }
                                                     }
                                                     else {

Response:
timer.cancel()
                                                     }
                                                 })
        Pair(compilerService, port)
    }
}<|endoftext|>


Prompt:
if (element != null) {
                    bindValue(value, element)
                }
                return value
            }
        }

        private fun add(instruction: Instruction) {
            pseudocode.addInstruction(instruction)
        }

        override fun createUnboundLabel(): Label = pseudocode.createLabel("L" + labelCount++, null)

Response:
override fun createUnboundLabel(name: String): Label = pseudocode.createLabel("L" + labelCount++, name)

        override fun enterLoop(expression: KtLoopExpression): LoopInfo {
            if (expression is KtDoWhileExpression) {
                (pseudocode.rootPseudocode as PseudocodeImpl).containsDoWhile = true
            }<|endoftext|>


Prompt:
+WasmEnvironmentConfigurationDirectives.GENERATE_SOURCE_MAP
        }
    }
}

open class AbstractK1WasmTypeScriptExportTest : AbstractK1WasmTest(
    "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/typescript-export/wasm/",
    "typescript-export/"
) {

Response:
override fun configure(builder: TestConfigurationBuilder) {
        super.configure(builder)
        builder.defaultDirectives {
            +WasmEnvironmentConfigurationDirectives.CHECK_TYPESCRIPT_DECLARATIONS
        }
    }
}

open class AbstractFirWasmTypeScriptExportTest : AbstractK1WasmTest(<|endoftext|>


Prompt:
import org.jetbrains.kotlin.types.Variance

abstract class AbstractHLExpressionTypeTest : AbstractAnalysisApiBasedTest() {
    override fun doTestByMainFile(mainFile: KtFile, mainModule: KtTestModule, testServices: TestServices) {

Response:
val selected = testServices.expressionMarkerProvider.getSelectedElementOfTypeByDirective(mainFile, mainModule).let {
            if (it is KtBlockExpression && it.statements.size == 1 && it.textRange == it.statements.single().textRange) {
                it.statements.single()
            } else {
                it
            }
        }<|endoftext|>


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

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


Prompt:
::JsCollectClassIdentifiersLowering,
    name = "CollectClassIdentifiersLowering",
    description = "Save classId before all the lowerings",
)

private val inventNamesForLocalClassesPhase = makeIrModulePhase(
    ::JsInventNamesForLocalClasses,
    name = "InventNamesForLocalClasses",
    description = "Invent names for local classes and anonymous objects",
)

Response:
private val annotationInstantiationLowering = makeIrModulePhase(
    ::JsAnnotationImplementationTransformer,
    name = "AnnotationImplementation",
    description = "Create synthetic annotations implementations and use them in annotations constructor calls"
)

private val expectDeclarationsRemovingPhase = makeIrModulePhase(
    ::ExpectDeclarationsRemoveLowering,
    name = "ExpectDeclarationsRemoving",<|endoftext|>


Prompt:
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun ULongArray.firstOrNull(predicate: (ULong) -> Boolean): ULong? {
    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.
 */

Response:
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun UByteArray.firstOrNull(predicate: (UByte) -> Boolean): UByte? {
    for (element in this) if (predicate(element)) return element
    return null
}

/**<|endoftext|>


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

import org.jetbrains.kotlin.analysis.api.KtTypeProjection
import org.jetbrains.kotlin.analysis.api.annotations.KtAnnotationsList
import org.jetbrains.kotlin.analysis.api.fir.KtSymbolByFirBuilder

Response:
import org.jetbrains.kotlin.analysis.api.fir.annotations.KtFirAnnotationListForType
import org.jetbrains.kotlin.analysis.api.fir.types.qualifiers.UsualClassTypeQualifierBuilder
import org.jetbrains.kotlin.analysis.api.fir.utils.cached<|endoftext|>


Prompt:
testInteropObjCSmoke("smoke")
    }

    @Test
    @TestMetadata("smoke_noopgc.kt")
    fun testInteropObjCSmokeNoopGC() {
        Assumptions.assumeTrue(testRunSettings.get<GCType>() == GCType.NOOP)

Response:
Assumptions.assumeTrue(testRunSettings.get<CacheMode>() == CacheMode.WithoutCache) // TODO: Remove line after fix of KT-63944
        testInteropObjCSmoke("smoke_noopgc")
    }

    private fun testInteropObjCSmoke(ktFilePrefix: String) {<|endoftext|>


Prompt:
* @return `true` if the two arrays are structurally equal, `false` otherwise.
 *
 * @sample samples.collections.Arrays.ContentOperations.booleanArrayContentEquals
 */
@SinceKotlin("1.4")
public actual infix fun BooleanArray?.contentEquals(other: BooleanArray?): Boolean {
    return contentEqualsInternal(other)
}

/**

Response:
* Checks if the two specified arrays are *structurally* equal to one another.
 *
 * Two arrays are considered structurally equal if they have the same size, and elements at corresponding indices are equal.
 *
 * The arrays are also considered structurally equal if both are `null`.
 *
 * @param other the array to compare with this array.<|endoftext|>


Prompt:
// !LANGUAGE: +VariableDeclarationInWhenSubject
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER

fun foo(): Any = 42
fun useInt(i: Int) {}

fun testShadowingParameter(y: Any) {
    when (val y = foo()) {
        else -> {}
    }
}

Response:
fun testShadowedInWhenBody(x: Any) {
    when (val y = x) {
        is String -> {
            val y = y.length
            useInt(y)
        }
    }
}

fun testShadowinLocalVariable() {
    val y = foo()
    when (val y = foo()) {
        else -> {}
    }
}<|endoftext|>


Prompt:
makeDescription(StandardNames.FqNames.number.toSafe(), "toDouble") to BuiltInWithDifferentJvmName(),
        makeDescription(StandardNames.FqNames.charSequence.toSafe(), "get", 1) to BuiltInWithDifferentJvmName(),
        makeDescription(StandardNames.FqNames.mutableList, "removeAt", 1) to

Response:
BuiltInWithDifferentJvmName(needsGenericSignature = true, isOverriding = false)
    )

    val specialMethodNames = (specialMethodsWithDefaults + specialMethods).map { (description) -> description.name }.toHashSet()
    val specialPropertyNames = specialProperties.map { (description) -> description.name }.toHashSet()

    fun findSpecialWithOverride(<|endoftext|>


Prompt: p19: Any?, p20: Any?, p21: Any?): Any? = call(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21)

Response: override fun invoke(p1: Any?, p2: Any?, p3: Any?, p4: Any?, p5: Any?, p6: Any?, p7: Any?, p8: Any?, p9: Any?, p10: Any?, p11: Any?, p12: Any?, p13: Any?, p14: Any?, p15: Any?, p16: Any?, p17: Any?, p18: Any?,<|endoftext|>


Prompt:
<!CANNOT_INFER_PARAMETER_TYPE, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Bar<!>().foo18(x)
    <!CANNOT_INFER_PARAMETER_TYPE, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Bar<!>().foo18(y)

Response:
foo21(x, Foo(Foo(OutBar())))
    foo21(y, Foo(Foo(OutBar())))

    foo22(x, Foo(Foo(InBar())))
    foo22(y, Foo(Foo(InBar())))

    foo23(x, Foo(Foo(Bar())))
    foo23(y, Foo(Foo(Bar())))<|endoftext|>


Prompt:
CallableId(name, pathFqName)
            }
            else -> CallableId(context.packageFqName, context.className, name)
        }

    fun currentDispatchReceiverType(): ConeClassLikeType? = currentDispatchReceiverType(context)

    /**
     * @return second from the end dispatch receiver. For the inner class constructor it would be the outer class.
     */

Response:
protected fun dispatchReceiverForInnerClassConstructor(): ConeClassLikeType? {
        val dispatchReceivers = context.dispatchReceiverTypesStack
        return dispatchReceivers.getOrNull(dispatchReceivers.lastIndex - 1)
    }

    fun callableIdForClassConstructor(): CallableId {
        val packageName = if (context.inLocalContext) {<|endoftext|>


Prompt:
override val returnExpressionCheckers: Set<FirReturnExpressionChecker>
        get() = setOf(
            FirReturnSyntaxAndLabelChecker,
            FirFunctionReturnTypeMismatchChecker
        )

    override val blockCheckers: Set<FirBlockChecker>
        get() = setOf(
            FirForLoopChecker,

Response:
FirConflictsExpressionChecker,
            FirSingleNamedFunctionChecker,
        )

    override val checkNotNullCallCheckers: Set<FirCheckNotNullCallChecker>
        get() = setOf(
            FirNotNullAssertionChecker,
        )

    override val elvisExpressionCheckers: Set<FirElvisExpressionChecker><|endoftext|>


Prompt:
when {
                targetType.isByte() -> invokeIntegerCoercionFunction(targetType, "toByte")
                targetType.isShort() -> invokeIntegerCoercionFunction(targetType, "toShort")
                targetType.isLong() -> invokeIntegerCoercionFunction(targetType, "toLong")

Response:
KotlinBuiltIns.isUByte(targetType) -> invokeUnsignedIntegerCoercionFunction(targetType, "toUByte")
                KotlinBuiltIns.isUShort(targetType) -> invokeUnsignedIntegerCoercionFunction(targetType, "toUShort")
                KotlinBuiltIns.isUInt(targetType) -> invokeUnsignedIntegerCoercionFunction(targetType, "toUInt")<|endoftext|>


Prompt: CANNOT_INFER_PARAMETER_TYPE, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getMyProperty<!>())

Response: var f: String by  <!CANNOT_INFER_PARAMETER_TYPE, CANNOT_INFER_PARAMETER_TYPE, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(<!CANNOT_INFER_PARAMETER_TYPE,<|endoftext|>


Prompt:
// TARGET_BACKEND: JS
// WITH_REFLECT
// KJS_WITH_FULL_RUNTIME

import kotlin.test.*
import kotlin.reflect.*

inline fun <reified R> kType() = typeOf<R>()

inline fun <reified R> kType(obj: R) = kType<R>()

class C<T>
class D

Response:
fun <T> kTypeForCWithTypeParameter() = kType<C<T>>()

class Outer<T> {
    companion object Friend
    inner class Inner<S>
}

object Object

fun testBasics1() {
    assertEquals("C<Int?>", kType<C<Int?>>().toString())<|endoftext|>


Prompt:
import org.jetbrains.kotlin.cfg.pseudocode.instructions.*
import org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.MagicInstruction
import org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.MagicKind

Response:
import org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.MergeInstruction
import org.jetbrains.kotlin.cfg.pseudocode.instructions.jumps.AbstractJumpInstruction
import org.jetbrains.kotlin.cfg.pseudocode.instructions.jumps.ConditionalJumpInstruction<|endoftext|>


Prompt:
expectFailure(linkage("Reference to function 'changedFun' can not be evaluated: No function found for symbol '/InterfaceWithChangedMembers.changedFun'")) { referenceChangedFunFromInterface() }

    expectFailure(linkage("Reference to function 'functionWithUnlinkedParameter' can not be evaluated: Function uses unlinked class symbol '/RemovedClass'")) { referenceFunctionWithUnlinkedParameter() }

Response:
expectFailure(linkage("Reference to function 'functionWithUnlinkedReturnValue' can not be evaluated: Function uses unlinked class symbol '/RemovedClass'")) { referenceFunctionWithUnlinkedReturnValue() }
    expectFailure(linkage("Reference to function 'functionWithRemovedTypeParameter' can not be evaluated: Function uses unlinked class symbol '/RemovedClass' (via type parameter 'T')")) { referenceFunctionWithRemovedTypeParameter() }<|endoftext|>


Prompt:
* store the resulting 'metadata path' in this index file.
 */
internal class KotlinMetadataLibrariesIndexFile(private val file: File) {
    fun read(): List<File> = file.readLines().map { File(it) }

    fun write(files: Iterable<File>) {
        val content = files.joinToString(System.lineSeparator()) { it.path }

Response:
file.writeText(content)
    }
}<|endoftext|>


Prompt:
if (a.w != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number"), DEBUG_INFO_SMARTCAST!>a.w<!>.funAny()
    if (a.w != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number & kotlin.Number?")!>a.w<!>.funNullableT()

Response:
if (a.w != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number & kotlin.Number?")!>a.w<!>.funNullableAny()
    if (a.w != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number & kotlin.Number?")!>a.w<!><|endoftext|>


Prompt:
package second

@Target(AnnotationTarget.TYPE)
annotation class Anno(val i: Int)

open class Base<T>

const val outer = 0
const val inner = ""

class MyCla<caret>ss() : @Anno(1 + outer) Base<@Anno(2 + outer) Base<@Anno(3 + outer) Int>>() {
    open class Base<T>

Response:
companion object {
        const val outer = ""
        const val inner = 0
    }
}<|endoftext|>


Prompt:
NoChildren2 <!TOO_MANY_ARGUMENTS!>{}<!>
                    NoChildren2()

                    <!OVERLOAD_RESOLUTION_AMBIGUITY!>MultiChildren<!> {}
                    MultiChildren { x ->
                        println(x)
                    }
                    MultiChildren { x, y ->
                        println(x + y)
                    }

Response:
<!NONE_APPLICABLE!>MultiChildren<!> { <!CANNOT_INFER_PARAMETER_TYPE!>x<!>,
                    <!CANNOT_INFER_PARAMETER_TYPE!>y<!>, <!CANNOT_INFER_PARAMETER_TYPE!>z<!> ->
                        println(x + y + z)
                    }
                }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
import org.jetbrains.kotlin.fir.types.*

Response:
import org.jetbrains.kotlin.name.StandardClassIds
import org.jetbrains.kotlin.name.StandardClassIds.Annotations.ParameterNames
import org.jetbrains.kotlin.resolve.UseSiteTargetsList
import org.jetbrains.kotlin.resolve.checkers.OptInNames<|endoftext|>


Prompt:
private fun putNeedClassReificationMarker(declaration: IrClass) {
        // Fix KT-55398, try to get nested irclass type parameters reified info
        val reifiedTypeParameters = closureReifiedMarkers.getOrPut(declaration) { declaration.reifiedTypeParameters }
        if (reifiedTypeParameters.wereUsedReifiedParameters()) {
            putNeedClassReificationMarker(mv)

Response:
propagateChildReifiedTypeParametersUsages(reifiedTypeParameters)
        }
    }

    private fun generateGlobalReturnFlagIfPossible(expression: IrExpression, label: String) {
        if (config.isInlineDisabled) {<|endoftext|>


Prompt:
// FIR_IDENTICAL
fun <<!VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED!>in<!> T> f() {

}

fun <<!VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED!>out<!> T> g() {

}

Response:
fun <<!VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED!>out<!> T, <!VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED!>in<!> X, Y> h() {

}<|endoftext|>


Prompt:
// the unsubstituted underlying constructor with signature '<T> (T) -> C<T>'
        // producing substituted underlying constructor with signature '(List<Int>) -> C<List<Int>>'.
        val substitutedTypeAliasConstructor = super.substitute(substitutor) as TypeAliasConstructorDescriptorImpl

Response:
val underlyingConstructorSubstitutor = TypeSubstitutor.create(substitutedTypeAliasConstructor.returnType)
        val substitutedUnderlyingConstructor = underlyingConstructorDescriptor.original.substitute(underlyingConstructorSubstitutor)
                ?: return null
        substitutedTypeAliasConstructor.underlyingConstructorDescriptor = substitutedUnderlyingConstructor
        return substitutedTypeAliasConstructor<|endoftext|>


Prompt:
object : GenericMetadataPropertyChecker<KmConstructor>("class.metadata.constructor.$name") {
        override fun getProperty(node: KmConstructor) = propertyGetter(node)
    }

fun functionMetadataPropertyChecker(name: String, propertyGetter: (KmFunction) -> String) =

Response:
object : GenericMetadataPropertyChecker<KmFunction>("class.metadata.function.$name") {
        override fun getProperty(node: KmFunction) = propertyGetter(node)
    }

fun typeAliasMetadataPropertyChecker(name: String, propertyGetter: (KmTypeAlias) -> String) =<|endoftext|>


Prompt:
versionRequirementTable?.writeInlineParameterNullCheckRequirement(proto::addVersionRequirement)
        }

        if (!DescriptorUtils.hasJvmNameAnnotation(descriptor) && requiresFunctionNameManglingForReturnType(descriptor)) {
            if (!useOldManglingScheme) {

Response:
versionRequirementTable?.writeNewFunctionNameManglingRequirement(proto::addVersionRequirement)
            }
            versionRequirementTable?.writeFunctionNameManglingForReturnTypeRequirement(proto::addVersionRequirement)
        }
    }

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


Prompt:
* Sorts the array in-place according to the order specified by the given [comparison] function.
 */
@Deprecated("Use other sorting functions from the Standard Library")
@DeprecatedSinceKotlin(warningSince = "1.6")
@kotlin.internal.InlineOnly
public inline fun CharArray.sort(noinline comparison: (a: Char, b: Char) -> Int): Unit {

Response:
nativeSort(comparison)
}

/**
 * Sorts the array in-place according to the order specified by the given [comparator].
 *
 * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.
 */
public actual fun <T> Array<out T>.sortWith(comparator: Comparator<in T>): Unit {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.psi2ir.generators.GeneratorContext

private val varTypeAnnotationFqName = FqName("kotlinx.cinterop.internal.CStruct.VarType")

@OptIn(ObsoleteDescriptorBasedAPI::class)
internal class CStructVarCompanionGenerator(
        context: GeneratorContext,

Response:
private val symbols: KonanSymbols
) : DescriptorToIrTranslationMixin {

    override val irBuiltIns: IrBuiltIns = context.irBuiltIns
    override val symbolTable: SymbolTable = context.symbolTable
    override val typeTranslator: TypeTranslator = context.typeTranslator<|endoftext|>


Prompt:
import org.jetbrains.kotlin.konan.test.blackbox.support.group.TestCaseGroupProvider
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.Settings
import org.jetbrains.kotlin.konan.test.blackbox.support.util.ThreadSafeCache

Response:
import org.jetbrains.kotlin.konan.test.blackbox.support.util.TreeNode
import org.jetbrains.kotlin.konan.test.blackbox.support.util.buildTree
import org.jetbrains.kotlin.konan.test.blackbox.support.util.startsWith<|endoftext|>


Prompt:
if (plus2.id() != 4)     return "Fail 2.2"
    if (plus3.id() != 5)     return "Fail 2.3"
    if (plus4.id() != 4)     return "Fail 2.4"
    if (plus5.id() != 4)     return "Fail 2.5"

Response:
if (plus6.id() != 4L)    return "Fail 2.6"
    if (plus7.id() != 4.0f)  return "Fail 2.7"
    if (plus8.id() != 4.0)   return "Fail 2.8"

    if (minus1.id() != -1)       return "Fail 3.1"<|endoftext|>


Prompt:
): ProcessorAction {
    val ownerTag = containingClass.symbol.toLookupTag()
    return processDirectOverriddenFunctionsWithBaseScope(functionSymbol) { overridden, _ ->
        val unwrapped = if (overridden.fir.isSubstitutionOverride && ownerTag.isRealOwnerOf(overridden))
            overridden.originalForSubstitutionOverride!!
        else
            overridden

Response:
processor(unwrapped)
    }
}

fun FirTypeScope.processOverriddenPropertiesFromSuperClasses(
    propertySymbol: FirPropertySymbol,
    containingClass: FirClass,
    processor: (FirPropertySymbol) -> ProcessorAction
): ProcessorAction {
    val ownerTag = containingClass.symbol.toLookupTag()<|endoftext|>


Prompt:
@OptIn(kotlin.native.runtime.NativeRuntimeApi::class, ObsoleteWorkersApi::class)
public fun performGCOnCleanerWorker(): Unit =
    getCleanerWorker().execute(TransferMode.SAFE, {}) {
        GC.collect()
    }.result

/**
 * Wait for a worker that executes Cleaner blocks to complete its scheduled tasks.
 */

Response:
@InternalForKotlinNative
@OptIn(ObsoleteWorkersApi::class)
public fun waitCleanerWorker(): Unit =
    getCleanerWorker().execute(TransferMode.SAFE, {}) {
        Unit
    }.result

@GCUnsafeCall("Kotlin_CleanerImpl_getCleanerWorker")
@OptIn(ObsoleteWorkersApi::class)<|endoftext|>


Prompt:
@kotlin.internal.InlineOnly
public inline fun kotlin.UIntArray.none(predicate: (kotlin.UInt) -> kotlin.Boolean): kotlin.Boolean

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

Response:
public inline fun kotlin.ULongArray.none(): kotlin.Boolean

@kotlin.SinceKotlin(version = "1.3")
@kotlin.ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun kotlin.ULongArray.none(predicate: (kotlin.ULong) -> kotlin.Boolean): kotlin.Boolean<|endoftext|>


Prompt:
if (elements is Collection) {
                val result = ArrayList<T>(this.size + elements.size)
                result.addAll(this)
                result.addAll(elements)
                return result
            } else {
                val result = ArrayList<T>(this)
                result.addAll(elements)
                return result
            }
            """
        }

Response:
specialFor(Sets) {
            doc {
                """
                Returns a set containing all elements of the original set and the given [elements] collection,
                which aren't already in this set.
                The returned set preserves the element iteration order of the original set.
                """
            }
            body {
                """<|endoftext|>


Prompt:
@kotlin.jvm.JvmName("maxWithOrThrow")
@Suppress("CONFLICTING_OVERLOADS")
public fun LongArray.maxWith(comparator: Comparator<in Long>): Long {
    if (isEmpty()) throw NoSuchElementException()
    var max = this[0]
    for (i in 1..lastIndex) {
        val e = this[i]

Response:
if (comparator.compare(max, e) < 0) max = e
    }
    return max
}

/**
 * Returns the first element having the largest value according to the provided [comparator].
 *
 * @throws NoSuchElementException if the array is empty.
 */
@SinceKotlin("1.7")<|endoftext|>


Prompt:
it is KtKotlinPropertySymbol && it.origin == KtSymbolOrigin.SOURCE_MEMBER_GENERATED && it.name == StandardNames.ENUM_ENTRIES
                    }
                }
                .filterNot {
                    it.hasTypeForValueClassInSignature()
                }

            val suppressStatic = classKind() == KtClassKind.COMPANION_OBJECT

Response:
createMethods(visibleDeclarations, result, suppressStatic = suppressStatic)

            createConstructors(declaredMemberScope.getConstructors(), result)

            addMethodsFromCompanionIfNeeded(result, classOrObjectSymbol)

            addMethodsFromDataClass(result, classOrObjectSymbol)
            addDelegatesToInterfaceMethods(result, classOrObjectSymbol)

            result
        }
    }<|endoftext|>


Prompt:
type: Inv<out [Error type: Resolution error type (Inconsistent type: In<out Out<out Int>> (0 parameter has declared variance: in, but argument variance is out))]>
    typeParameter: <T> defined in Inv
    typeProjection: out [Error type: Resolution error type (Inconsistent type: In<out Out<out Int>> (0 parameter has declared variance: in, but argument variance is out))]

Response:
psi: val foo = getT<Inv<out In<out Out<out Int>>>>()
    type: [Error type: Resolution error type (Inconsistent type: In<out Out<out Int>> (0 parameter has declared variance: in, but argument variance is out))]
*/<|endoftext|>


Prompt:
checkReferenceIsToAllowedMember(descriptor, context.trace, expression)

        val scope = context.scope.ownerDescriptor
        val type = createKCallableTypeForReference(descriptor, lhs, reflectionTypes, scope) ?: return null

        when (descriptor) {
            is FunctionDescriptor -> bindFunctionReference(expression, type, context, descriptor)

Response:
is PropertyDescriptor -> bindPropertyReference(expression, type, context, isMutablePropertyReference(descriptor, lhs, scope))
        }

        return type
    }

    internal fun checkReferenceIsToAllowedMember(
        descriptor: CallableDescriptor, trace: BindingTrace, expression: KtCallableReferenceExpression
    ) {
        val simpleName = expression.callableReference<|endoftext|>


Prompt:
languageVersionSettings.supportsFeature(LanguageFeature.JvmInlineValueClasses)) &&
            languageVersionSettings.supportsFeature(LanguageFeature.AllowResultInReturnType)
        ) return

        if (languageVersionSettings.supportsFeature(LanguageFeature.AllowNullOperatorsForResultAndResultReturnTypeByDefault)) return

Response:
if (declaration !is KtCallableDeclaration || descriptor !is CallableMemberDescriptor) return

        val returnType = descriptor.returnType ?: return
        if (isForbiddenReturnType(returnType, declaration, descriptor)) {
            val typeReferenceOrDeclarationName = declaration.typeReference ?: declaration.nameIdentifier ?: return<|endoftext|>


Prompt:
override val atomicLongArrayClassSymbol: IrClassSymbol
        get() = context.referenceClass(ClassId(FqName("kotlin.concurrent"), Name.identifier("AtomicLongArray")))
            ?: error("kotlin.concurrent.AtomicLongArray is not found")

    // kotlin.concurrent.AtomicArray

Response:
override val atomicRefArrayClassSymbol: IrClassSymbol
        get() = context.referenceClass(ClassId(FqName("kotlin.concurrent"), Name.identifier("AtomicArray")))
            ?: error("kotlin.concurrent.AtomicArray is not found")

    override fun getAtomicArrayConstructor(atomicArrayClassSymbol: IrClassSymbol): IrFunctionSymbol =<|endoftext|>


Prompt:
declarationRenderer?.render(constructor)

            constructor.typeParameters.renderTypeParameters()
            valueParameterRenderer?.renderParameters(constructor.valueParameters)
            print(": ")
            constructor.returnTypeRef.accept(this)
            val body = constructor.body
            val delegatedConstructor = constructor.delegatedConstructor
            if (body == null) {

Response:
bodyRenderer?.renderDelegatedConstructor(delegatedConstructor)
            }
            bodyRenderer?.renderBody(body, listOfNotNull<FirStatement>(delegatedConstructor))
        }

        override fun visitErrorPrimaryConstructor(errorPrimaryConstructor: FirErrorPrimaryConstructor) = visitConstructor(errorPrimaryConstructor)<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeAliasSymbol
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
import org.jetbrains.kotlin.fir.types.*

Response:
import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef
import org.jetbrains.kotlin.fir.types.impl.FirImplicitBuiltinTypeRef
import org.jetbrains.kotlin.fir.visitors.FirDefaultTransformer
import org.jetbrains.kotlin.fir.visitors.FirDefaultVisitor<|endoftext|>


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

import java.io.File

/**
 * Represents a source set for a given Kotlin Gradle project.
 * @see KotlinProject
 */
interface SourceSet {

    /**
     * Possible source set types.
     */
    enum class SourceSetType {
        PRODUCTION,
        TEST
    }

    /**

Response:
* Return the source set name.
     *
     * @return the source set name.
     */
    val name: String

    /**
     * Return the type of the source set.
     *
     * @return the type of the source set.
     */
    val type: SourceSetType

    /**
     * Return the names of all friend source sets.
     *
     * @return friend source sets.<|endoftext|>


Prompt:
val directNestedClasses: Collection<KmClass> = node.classes.mapNotNull { (nestedClassName, nestedClassNode) ->
            val nestedClassContext = classContext.classifierContext(nestedClassName, classTypeParametersCount)
            val nestedClass: KmClass = nestedClassNode.accept(this, nestedClassContext)?.cast() ?: return@mapNotNull null

Response:
classConsumer.consume(nestedClass)
            statsCollector?.logClass(nestedClass, nestedClassContext)
            nestedClass
        }

        val nestedConstructors: Collection<KmConstructor> = node.constructors.mapNotNull { (constructorKey, constructorNode) ->
            val constructorContext = classContext.callableMemberContext(DEFAULT_CONSTRUCTOR_NAME, classTypeParametersCount)<|endoftext|>


Prompt:
override fun check(declaration: FirBackingField, context: CheckerContext, reporter: DiagnosticReporter) {
        if (declaration !is FirDefaultPropertyBackingField &&
            !context.session.languageVersionSettings.supportsFeature(LanguageFeature.ExplicitBackingFields)
        ) {
            reporter.reportOn(
                declaration.source,

Response:
FirErrors.UNSUPPORTED_FEATURE,
                LanguageFeature.ExplicitBackingFields to context.session.languageVersionSettings,
                context
            )
        }
    }
}<|endoftext|>


Prompt:
fun get(id: String): Promise<JsAny?>
    fun matchAll(options: ClientQueryOptions = definedExternally): Promise<JsArray<Client>>
    fun openWindow(url: String): Promise<WindowClient?>
    fun claim(): Promise<Nothing?>
}

public external interface ClientQueryOptions : JsAny {
    var includeUncontrolled: Boolean? /* = false */
        get() = definedExternally

Response:
set(value) = definedExternally
    var type: ClientType? /* = ClientType.WINDOW */
        get() = definedExternally
        set(value) = definedExternally
}

@Suppress("UNUSED_PARAMETER")<|endoftext|>


Prompt:
val (simpleNameAddress, simpleNamePoolId) = context.referenceStringLiteralAddressAndId(simpleName)

        val typeInfo = ConstantDataStruct(
            name = "TypeInfo",
            elements = listOf(
                ConstantDataIntField("TypePackageNameLength", packageName.length),
                ConstantDataIntField("TypePackageNameId", packageNamePoolId),

Response:
ConstantDataIntField("TypePackageNamePtr", packageNameAddress),
                ConstantDataIntField("TypeNameLength", simpleName.length),
                ConstantDataIntField("TypeNameId", simpleNamePoolId),
                ConstantDataIntField("TypeNamePtr", simpleNameAddress)
            )
        )<|endoftext|>


Prompt:
// FILE: 1.kt
package test

interface Foo {
    fun call(): String
}

inline fun f(crossinline g: () -> String) = object: Foo {
    fun <T> foo() = g()
    fun <T> bar() = "K"
    override fun call(): String = foo<String>() + bar<String>()
}

// FILE: 2.kt
import test.*

Response:
val x = f { "O" }

fun box() : String {
    return x.call()
}<|endoftext|>


Prompt:
}

object TestFn16 : TestFnBase {
    override fun testGood(x: Any) =
            reifiedSafeAsReturnsNonNull<Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>>(

Response:
x, "x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>")
    override fun testBad(x: Any) =<|endoftext|>


Prompt:
class Lazy(override val name: String, private val lazyValue: kotlin.Lazy<String?>) : ComputedTestProperty() {
        override val value get() = lazyValue.value
    }
}

private class ComputedTestProperties(private val task: Test) {
    private val computedProperties = arrayListOf<ComputedTestProperty>()

Response:
fun Project.compute(property: TestProperty, defaultValue: () -> String? = { null }) {
        val gradleValue = readFromGradle(property)
        computedProperties += ComputedTestProperty.Normal(property.fullName, gradleValue ?: defaultValue())
    }

    fun Project.computeLazy(property: TestProperty, defaultLazyValue: () -> Lazy<String?>) {<|endoftext|>


Prompt:
if (isNotEqualAnyNullableLeft<String>(null, null)) return "Fail 20"
    if (isNotEqualAnyNullableLeft(A(""), A(""))) return "Fail 21"
    if (!isNotEqualAnyNullableLeft(A(""), "")) return "Fail 22"
    if (!isNotEqualAnyNullableLeft<String>(null, "")) return "Fail 23"

Response:
if (!isNotEqualAnyNullableLeft(A(""), null)) return "Fail 24"
    if (!isNotEqualAnyNullableLeft(A(""), A("a"))) return "Fail 25"
    if (isNotEqualAnyNullableRight<String>(null, null)) return "Fail 26"
    if (isNotEqualAnyNullableRight(A(""), A(""))) return "Fail 27"<|endoftext|>


Prompt:
"kotlin.Short" -> return (a as Int).rem(b as Short)
            }
            "kotlin.Float" -> when (typeB) {
                "kotlin.Byte" -> return (a as Float).rem(b as Byte)
                "kotlin.Double" -> return (a as Float).rem(b as Double)

Response:
"kotlin.Float" -> return (a as Float).rem(b as Float)
                "kotlin.Int" -> return (a as Float).rem(b as Int)
                "kotlin.Long" -> return (a as Float).rem(b as Long)
                "kotlin.Short" -> return (a as Float).rem(b as Short)
            }<|endoftext|>


Prompt:
val passedTypeArgumentsToInvoke = outerCall.typeArguments.isNotEmpty() &&
                    resolvedCall.functionCall.candidateDescriptor.typeParameters.isNotEmpty()
            return passedTypeArgumentsToInvoke && resolvedCall.variableCall.candidateDescriptor.typeParameters.isNotEmpty()
        }
    }
}

fun FunctionDescriptor.isOperatorMod(): Boolean {

Response:
return this.isOperator && name in OperatorConventions.REM_TO_MOD_OPERATION_NAMES.values
}

fun shouldWarnAboutDeprecatedModFromBuiltIns(languageVersionSettings: LanguageVersionSettings): Boolean {
    return languageVersionSettings.supportsFeature(LanguageFeature.OperatorRem) && languageVersionSettings.apiVersion >= ApiVersion.KOTLIN_1_1
}<|endoftext|>


Prompt:
""".trimIndent()
            )

            simpleSingleSourceTarget(
                "b", """
                    class AB
                    typealias TA_AB = AB
                    val x: TA_AB = TA_AB()
                """.trimIndent()
            )
        }

        result.assertCommonized(
            "(a, b)", """
                expect class AB()
                typealias TA_AB = AB

Response:
expect val x: TA_AB
        """.trimIndent()
        )
    }

    fun `test property with and without setter`() {
        val result = commonize {
            outputTarget("(a, b)")

            simpleSingleSourceTarget(
                "a", """
                    val x: Int = 42
                """.trimIndent()
            )<|endoftext|>


Prompt:
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.isInlineClass

Response:
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.asTypeProjection

class ReceiverTypeAndTypeParameters(val receiverType: KotlinType, val typeParameters: List<TypeParameterDescriptor>)

fun patchTypeParametersForDefaultImplMethod(function: CallableMemberDescriptor): ReceiverTypeAndTypeParameters {<|endoftext|>


Prompt:
is PsiElement -> if (!source.isFakePsiElement) extractLocation(source) else null
            else -> null
        }
    }

    private fun extractLocation(element: PsiElement): JsLocation {
        val file = element.containingFile
        val document = file.viewProvider.document!!

        val path = pathResolver(File(file.viewProvider.virtualFile.path))

Response:
val startOffset = element.node.startOffset
        val startLine = document.getLineNumber(startOffset)
        val startChar = startOffset - document.getLineStartOffset(startLine)

        return JsLocation(path, startLine, startChar)
    }
}<|endoftext|>


Prompt:
assertEquals(tosses1, tosses2)
        }

        arrayOf("x").let { singletonArray ->
            val tosses = List(10) { singletonArray.random() }
            assertEquals(singletonArray.toList(), tosses.distinct())
        }

        assertFailsWith<NoSuchElementException> { emptyArray<Any>().random() }
    }

Response:
@Test fun randomOrNull() {
        Array(100) { it }.let { array ->
            val tosses = List(10) { array.randomOrNull() }
            assertTrue(tosses.distinct().size > 1, "Should be some distinct elements in $tosses")

            val seed = Random.nextInt()
            val random1 = Random(seed)<|endoftext|>


Prompt:
private fun ExportedConstructor.generateTypeScriptString(indent: String): String {
        return "${visibility.keyword}constructor(${parameters.generateTypeScriptString(indent)});"
    }

    private fun ExportedConstructSignature.generateTypeScriptString(indent: String): String {

Response:
return "new(${parameters.generateTypeScriptString(indent)}): ${returnType.toTypeScript(indent)};"
    }

    private fun ExportedProperty.generateTypeScriptString(indent: String, prefix: String, esModules: Boolean = false): String {
        val extraIndent = "$indent    "
        val optional = if (isOptional) "?" else ""<|endoftext|>


Prompt: if (b.foo(4) != "B.foo(4: Int)") return "b.foo(4) != \"B.foo(4: Int)\", it: ${b.foo(4)}"

Response: if (b.boo(434) != "A.boo(434)") return "b.boo(434) != \"A.boo(434)\", it: ${b.boo(434)}"<|endoftext|>


Prompt:
get() = annotationClass!!

    override val AnnotationDescriptor.fqName: FqName?
        get() = fqName

    override fun AnnotationDescriptor.enumArguments(onlyValue: Boolean): Iterable<String> =
        allValueArguments.flatMap { (parameter, argument) ->

Response:
if (!onlyValue || parameter == JvmAnnotationNames.DEFAULT_ANNOTATION_MEMBER_NAME)
                argument.toEnumNames()
            else
                emptyList()
        }

    private fun ConstantValue<*>.toEnumNames(): List<String> =
        when (this) {
            is ArrayValue -> value.flatMap { it.toEnumNames() }<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_EXPRESSION
// SKIP_TXT
// WITH_EXTENDED_CHECKERS

/*
 * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE)
 *
 * SECTIONS: dfa
 * NUMBER: 19
 * DESCRIPTION: Raw data flow analysis test

Response:
* HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses
 */

// TESTCASE NUMBER: 1
fun case_1(x: Any?) {
    if (x is Int) {
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Int")!>x<!><|endoftext|>


Prompt:
val parameterList = KotlinPlaceHolderStubImpl<KtParameterList>(functionType, KtStubElementTypes.VALUE_PARAMETER_LIST)
        val typeArgumentsWithoutReceiverAndReturnType = typeArgumentList.subList(processedTypes, typeArgumentList.size - 1)
        var suspendParameterType: Type? = null

Response:
for ((index, argument) in typeArgumentsWithoutReceiverAndReturnType.withIndex()) {
            val parameterType = argument.type(c.typeTable)!!
            if (isSuspend && index == typeArgumentsWithoutReceiverAndReturnType.size - 1) {
                if (parameterType.hasClassName() && parameterType.argumentCount == 1) {<|endoftext|>


Prompt:
callsInPlace(block2, InvocationKind.AT_LEAST_ONCE)
        callsInPlace(block3, InvocationKind.EXACTLY_ONCE)
    }
    block1()
    block2()
    block2()
    block3()
}

// FILE: main.kt

import contracts.*

// TESTCASE NUMBER: 1
fun case_1() {

Response:
val value_1: Int
    funWithExactlyOnceCallsInPlace({ value_1 = 11 })
    value_1.inc()
}

// TESTCASE NUMBER: 2
fun case_2() {
    var value_1: Int
    funWithAtLeastOnceCallsInPlace({ value_1 = 11 })
    value_1.inc()
}<|endoftext|>


Prompt:
if (actualReachableNodes < minThreshold || actualReachableNodes > maxThreshold) {
            val message = "Number of reachable nodes ($actualReachableNodes) does not fit into expected range " +
                    "[$minThreshold; $maxThreshold]"
            val additionalMessage: String =
                if (overwriteReachableNodes) {

Response:
val oldValue = "// ${JsEnvironmentConfigurationDirectives.EXPECTED_REACHABLE_NODES.name}: $expectedReachableNodes"
                    val newText = fileContent.replaceFirst(oldValue, replacement)
                    file.writeText(newText)
                    ""
                } else {
                    "\n$enablingMessage"
                }

            throw AssertionError("$message$additionalMessage")<|endoftext|>


Prompt:
if (a is String) {
        var b = a
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String")!>b<!>
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>b<!>.length

Response:
if (<!USELESS_IS_CHECK!>a is String<!>) {
            b = a
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String")!>b<!>
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>b<!>.length<|endoftext|>


Prompt:
fun builder(c: suspend () -> Unit) {
    c.startCoroutine(Continuation(EmptyCoroutineContext) {
        it.getOrThrow()
    })
}

fun box(): String {
    var res = "FAIL 1"
    builder {
        val impl = SuspendImpl()
        val implResult = impl.execute()
        res = implResult.getOrThrow()
    }

Response:
if (res != "OK") return res

    res = "FAIL 2"
    builder {
        val iface: SuspendInterface = SuspendImpl()
        val result = iface.execute()
        res = result.getOrThrow()
    }
    return res
}<|endoftext|>


Prompt:
val expectedContextReceivers = expectedType.getContextReceiverTypesFromFunctionType().map { it.unwrap() }.toTypedArray()
    val argumentAsFunctionExpression = argument as? FunctionExpression

    val receiverFromExpected = argumentAsFunctionExpression?.receiverType == null && expectedReceiver != null

    fun UnwrappedType?.orExpected(index: Int) =

Response:
this ?: expectedParameters.getOrNull(index)?.type?.unwrap() ?: expectedType.builtIns.nullableAnyType

    // Extracting parameters and receiver type, taking into account the actual lambda definition and expected lambda type
    val (parameters, receiver) = when {
        argumentAsFunctionExpression != null -> {
            // lambda has explicit functional type - use types from it if available<|endoftext|>


Prompt:
z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z +
            z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z +

Response:
z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + z + //200
            z //201
}
// 2 INVOKEDYNAMIC makeConcatWithConstants
// 0 append
// 0 stringPlus<|endoftext|>


Prompt: // test.kt:11 compute: a="a":kotlin.String, gLocal="gLocal":kotlin.String, hLocal="hLocal":kotlin.String, b="b":kotlin.String

Response: // test.kt:20 compute: a="a":kotlin.String, gLocal="gLocal":kotlin.String, hLocal="hLocal":kotlin.String, b="b":kotlin.String, h="h":kotlin.String<|endoftext|>


Prompt:
if (0UL in 10UL downTo 1UL) throw AssertionError()
    if (1UL !in 10UL downTo 1UL) throw AssertionError()
    if (5UL !in 10UL downTo 1UL) throw AssertionError()
    if (10UL !in 10UL downTo 1UL) throw AssertionError()

Response:
if (20UL in 10UL downTo 1UL) throw AssertionError()

    if (0UL in M2 downTo M1) throw AssertionError()
    if (1UL in M2 downTo M1) throw AssertionError()
    if (10UL in M2 downTo M1) throw AssertionError()<|endoftext|>


Prompt:
TestClass.intNWrapperN = null
    assertEquals("null (object)", describeValueOfProperty(TestClass, "intNWrapperN"))
    assertEquals(null, TestClass.intNWrapperN?.value)

    assertEquals("null (object)", describeValueOfProperty(TestClass, "fooWrapper"))
    TestClass.fooWrapper = FooWrapper(Foo("cat"))

Response:
assertEquals("Foo(s=cat) (object)", describeValueOfProperty(TestClass, "fooWrapper"))
    assertEquals("cat", TestClass.fooWrapper.foo.s)

    assertEquals("null (object)", describeValueOfProperty(TestClass, "fooWrapperN"))
    TestClass.fooWrapperN = FooWrapper(Foo("dog"))<|endoftext|>


Prompt:
private val stateStackHolder = ThreadLocal.withInitial<MutableList<FirInProcessOfResolvingToJumpingPhaseState>> {
        mutableListOf()
    }

    /**
     * Adds [newState] to the stack and set [waitingFor][FirInProcessOfResolvingToJumpingPhaseState.waitingFor]
     * for the previous state if needed
     */

Response:
fun push(newState: FirInProcessOfResolvingToJumpingPhaseState) {
        val states = stateStackHolder.get()

        val currentState = states.lastOrNull()
        currentState?.waitingFor = newState
        states += newState
    }

    /**
     * Pops from the top of the stack the last state and return it.<|endoftext|>


Prompt:
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.ir.util.IdSignature
import org.jetbrains.kotlin.ir.util.KotlinMangler
import org.jetbrains.kotlin.load.java.descriptors.JavaForKotlinOverridePropertyDescriptor

Response:
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.descriptorUtil.overriddenTreeAsSequence
import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor<|endoftext|>


Prompt:
staticFramework.convention(false)
        destinationDir.convention(debuggable.flatMap {
            val kind = outputKind.visibleName
            val target = konanTarget.visibleName
            val type = if (it) "debug" else "release"
            projectLayout.buildDirectory.dir("out/$kind/$target/$type")
        })
    }

    @TaskAction

Response:
fun link() {
        val metricReporter = metrics.get()

        addBuildMetricsForTaskAction(metricsReporter = metricReporter, languageVersion = null) {

            val outFile = outputFile.get()
            outFile.ensureParentDirsCreated()

            fun FileCollection.klibs() = files.filter { it.extension == "klib" }<|endoftext|>


Prompt:
accessor.constant != null -> renderValueUsage(accessor.constant)
                else -> error("Bridge body for getter was not generated")
            }
        }

        is PropertyAccessor.Getter.GetConstructorParameter -> accessor.constructorParameter.name

        is PropertyAccessor.Getter.ArrayMemberAt -> "arrayMemberAt(${accessor.offset})"

Response:
is PropertyAccessor.Getter.MemberAt -> {
            val typeArguments = renderTypeArguments(accessor.typeArguments)
            val valueAccess = if (accessor.hasValueAccessor) ".value" else ""
            "memberAt$typeArguments(${accessor.offset})$valueAccess"
        }

        is PropertyAccessor.Getter.ReadBits -> {<|endoftext|>


Prompt:
contract { returns(null) implies (this@case_1_2 is String) }
    return if (this@case_1_2 is String) null else true
}

// TESTCASE NUMBER: 2
fun <T : Number?> T.case_2_1(): Boolean? {
    contract { returnsNotNull() implies (this@case_2_1 != null) }

Response:
return if (this@case_2_1 != null) true else null
}
fun <T : Number?> T.case_2_2(): Boolean? {
    contract { returns(null) implies (this@case_2_2 != null) }
    return if (this@case_2_2 != null) null else true
}

// FILE: main.kt

import contracts.*<|endoftext|>


Prompt:
val left = evaluate(binaryLogicExpression.leftOperand)
            val right = evaluate(binaryLogicExpression.rightOperand)

            val leftBoolean = left.unwrapOr<FirLiteralExpression<*>> { return it }?.value as? Boolean ?: return NotEvaluated

Response:
val rightBoolean = right.unwrapOr<FirLiteralExpression<*>> { return it }?.value as? Boolean ?: return NotEvaluated
            val result = when (binaryLogicExpression.kind) {
                LogicOperationKind.AND -> leftBoolean && rightBoolean
                LogicOperationKind.OR -> leftBoolean || rightBoolean<|endoftext|>


Prompt:
v.castIfNeeded(elementSerializer.asmType)

        v.invokevirtual(collectionType.internalName, "add", "(Ljava/lang/Object;)Z", false) // -> bool
        v.pop()
    }
}

internal class MapParcelSerializer(
    asmType: Type,
    private val keySerializer: ParcelSerializer,

Response:
elementSerializer: ParcelSerializer,
    frameMap: FrameMap
) : AbstractCollectionParcelSerializer(asmType, elementSerializer, frameMap) {
    override fun getSize(v: InstructionAdapter) {
        v.invokeinterface("java/util/Map", "size", "()I")
    }

    override fun getIterator(v: InstructionAdapter) {<|endoftext|>


Prompt:
val subprojectBuildScript = subProject(subproject).buildGradleKts
                assert("dependencies {" in subprojectBuildScript.readText())
                subprojectBuildScript.modify {
                    it.replace(
                        "dependencies {",
                        """
                        tasks.whenTaskAdded {} // break lazy initialization of all tasks
                        dependencies {
                    """.trimIndent()
                    )
                }
            }

Response:
build("build")
        }
    }

    @MppGradlePluginTests
    @GradleTest
    @DisplayName("works in MPP") // aka KT-56131
    fun testBrokenTcaInMpp(gradleVersion: GradleVersion) {
        project("new-mpp-lib-with-tests", gradleVersion) {<|endoftext|>


Prompt:
public inline fun <R : Comparable<R>> LongArray.minBy(selector: (Long) -> R): Long? {
    return minByOrNull(selector)
}

@Deprecated("Use minByOrNull instead.", ReplaceWith("this.minByOrNull(selector)"))

Response:
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5", hiddenSince = "1.6")
@Suppress("CONFLICTING_OVERLOADS")
public inline fun <R : Comparable<R>> FloatArray.minBy(selector: (Float) -> R): Float? {
    return minByOrNull(selector)
}<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNCHECKED_CAST
// SKIP_TXT
// Issue: KT-20849

fun <T>test_1(x: T): T = null as T
fun <T>test_2(x: () -> T): T = null as T

fun case_1() {

Response:
null?.run { return }
    null!!.run { throw Exception() }
}

fun case_2() {
    test_1 { null!! }
    test_2 { null!! }
}

fun case_3() {
    test_1 { throw Exception() }
    test_2 { throw Exception() }
}

fun case_6() {
    null!!
}<|endoftext|>


Prompt:
OPTIONAL_JVM_INLINE_ANNOTATION
value class I32<T: Int>(val value: T) : IFoo

fun <T: Int> boxToTypeParameter(x: I32<T>?) = BoxT(x)
fun <T: Int> boxToTypeParameter2(x: I32<T>?) = BoxT2(x)

Response:
fun <T: Int> boxToNullableAny(x: I32<T>?) = BoxAny(x)
fun <T: Int> boxToNullableInterface(x: I32<T>?) = BoxFoo(x)

fun <T: Int> useNullableI32(x: I32<T>?) {
    if (x != null) throw AssertionError()
}<|endoftext|>


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

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

package org.jetbrains.kotlin.sir.builder

import kotlin.contracts.*
import org.jetbrains.kotlin.sir.*

Response:
import org.jetbrains.kotlin.sir.impl.SirSetterImpl

@SirBuilderDsl
class SirSetterBuilder {
    var origin: SirOrigin = SirOrigin.Unknown
    var visibility: SirVisibility = SirVisibility.PUBLIC
    var documentation: String? = null
    lateinit var kind: SirCallableKind
    var body: SirFunctionBody? = null<|endoftext|>


Prompt:
private fun resolveSupertypesByPropertyName(supertypes: Collection<KotlinType>, propertyName: Name): Collection<KotlinType> =
    resolveSupertypesByMembers(supertypes, allowNonConcreteInterfaceMembers = true) {
        getPropertyMembers(it, propertyName)
    }.first

private inline fun resolveSupertypesByMembers(
    supertypes: Collection<KotlinType>,

Response:
allowNonConcreteInterfaceMembers: Boolean,
    getMembers: (KotlinType) -> Collection<CallableMemberDescriptor>
): Pair<Collection<KotlinType>, Boolean> {
    val typesWithConcreteMembers = SmartList<KotlinType>()
    val typesWithNonConcreteMembers = SmartList<KotlinType>()

    for (supertype in supertypes) {<|endoftext|>


Prompt:
* Encodes bytes from the specified [source] array or its subrange and writes resulting symbols into the [destination] array.
     * Returns the number of symbols written.
     *
     * If the size of the [source] array or its subrange is not an integral multiple of 3,
     * the result is padded with `'='` to an integral multiple of 4 symbols.
     *

Response:
* @param source the array to encode bytes from.
     * @param destination the array to write symbols into.
     * @param destinationOffset the starting index in the [destination] array to write symbols to, 0 by default.
     * @param startIndex the beginning (inclusive) of the subrange to encode, 0 by default.<|endoftext|>