Prompt:
val type: WasmType,
    val values: List<WasmTable.Value>,
    val mode: Mode,
) : WasmNamedModuleField() {
    sealed class Mode {
        object Passive : Mode()
        class Active(val table: WasmTable, val offset: List<WasmInstr>) : Mode()
        object Declarative : Mode()
    }
}

class WasmTag(

Response:
val type: WasmFunctionType,
    val importPair: WasmImportDescriptor? = null
) : WasmNamedModuleField() {
    init {
        assert(type.resultTypes.isEmpty()) { "Must have empty return as per current spec" }
    }
}

class WasmLocal(
    val id: Int,
    val name: String,
    val type: WasmType,<|endoftext|>


Prompt:
// No implicit bodies here
            }
            else -> throwUnexpectedFirElementError(target)
        }

        @Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
        (target as FirDeclaration).forEachDeclarationWhichCanHavePostponedSymbols(::publishPostponedSymbols)
    }

Response:
private fun publishPostponedSymbols(target: FirCallableDeclaration) {
        val postponedSymbols = llImplicitBodyResolveComputationSession.postponedSymbols(target)
        if (postponedSymbols.isNotEmpty()) {
            target.postponedSymbolsForAnnotationResolution = postponedSymbols
        }
    }<|endoftext|>


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

Response:
fun testR0xE22() {
    // with possible local optimizations
    if (4 in 1L..<3L != range0.contains(4)) throw AssertionError()
    if (4 !in 1L..<3L != !range0.contains(4)) throw AssertionError()<|endoftext|>


Prompt:
public abstract int hashCode();
    @Override
    public abstract String toString();
}

// FILE: JC2.java
public abstract class JC2 extends JC {
}

// FILE: box.kt

interface KI : JI
class X : KI {
    override fun equals(other: Any?): Boolean = true
    override fun hashCode(): Int = 0

Response:
override fun toString(): String = ""
}

abstract class KC : JC()
class Y : KC() {
    override fun equals(other: Any?): Boolean = true
    override fun hashCode(): Int = 0
    override fun toString(): String = ""
}

abstract class KC2 : JC2()
class Z : KC2() {<|endoftext|>


Prompt:
specificityComparator,
    inferenceComponents,
    transformerComponents,
    considerMissingArgumentsInSignatures = false,
) {

    override fun chooseMaximallySpecificCandidates(
        candidates: Set<Candidate>,
        discriminateAbstracts: Boolean,
    ): Set<Candidate> = chooseMaximallySpecificCandidates(
        candidates,
        discriminateAbstracts,

Response:
// We don't discriminate against generics for callable references because, other than in regular calls,
        // there is no syntax for specifying generic type arguments.
        discriminateGenerics = candidates.first().callInfo.callSite !is FirCallableReferenceAccess
    )

    /**<|endoftext|>


Prompt:
const val aa = "INT " + uint
const val bb = "BYTE " + ubyte
const val cc = "LONG " + ulong

fun box(): String {
    if (a != "INT 2415919103") {
        return "FAIL 0: $a"
    }
    if (aa != "INT 2415919103") {
        return "FAIL 1: $aa"
    }

Response:
if (b != "BYTE 2303") {
        return "FAIL 2: $b"
    }
    if (bb != "BYTE 2303") {
        return "FAIL 3: $bb"
    }

    if (c != "LONG 281474976710655") {
        return "FAIL 4: $c"
    }<|endoftext|>


Prompt:
* Convert types which do not have members - kotlin.Nothing and `dynamic` - to kotlin.Any.
         */
        private fun ConeKotlinType.coerceToAny(): ConeKotlinType {
            return when {
                this.isNothingOrNullableNothing -> session.builtinTypes.anyType.type

Response:
this is ConeDynamicType -> session.builtinTypes.anyType.type
                else -> this
            }
        }

        fun generateDispatchReceiverParameter(irFunction: IrFunction) =
            irFunction.declareThisReceiverParameter(
                c,
                irClass.defaultType,
                IrDeclarationOrigin.DEFINED,
                UNDEFINED_OFFSET,<|endoftext|>


Prompt:
fun objcReleaseFromNativeThreadState(objCReference: LLVMValueRef) {
        // It is nounwind, so no exception handler is required.
        call(objCExportCodegen.objcRelease, listOf(objCReference), exceptionHandler = ExceptionHandler.None)
    }

    override fun processReturns() {
        // Do nothing.
    }

Response:
val terminatingExceptionHandler = object : ExceptionHandler.Local() {
        override val unwind: LLVMBasicBlockRef by lazy {
            val result = basicBlockInFunction("fatal_landingpad", endLocation)
            appendingTo(result) {
                val landingpad = gxxLandingpad(0)
                LLVMSetCleanup(landingpad, 1)<|endoftext|>


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

fun <T> underlying(a: IC): T = bar(a) {
    it.value as T
}

fun <T> extension(a: IC): T = bar(a) {
    it.extensionValue()
}

Response:
fun <T> dispatch(a: IC): T = bar(a) {
    it.dispatchValue()
}

fun <T> normal(a: IC): T = bar(a) {
    normalValue(it)
}

fun interface FunIFace<T, R> {
    fun call(ic: T): R
}<|endoftext|>


Prompt:
val specificCapturedType = AbstractTypeChecker.prepareType(context, specificType)
                .let { if (captureFromArgument) context.captureFromExpression(it) ?: it else it }
            addSubtypeConstraint(specificCapturedType, substitutedGeneralType)
        }
    }

    return true
}

Response:
fun <T> SimpleConstraintSystem.isSignatureNotLessSpecific(
    specific: FlatSignature<T>,
    general: FlatSignature<T>,
    callbacks: SpecificityComparisonCallbacks,
    specificityComparator: TypeSpecificityComparator,
    useOriginalSamTypes: Boolean = false
): Boolean {
    if (specific.hasExtensionReceiver != general.hasExtensionReceiver) return false<|endoftext|>


Prompt:
import org.jetbrains.kotlin.scripting.compiler.plugin.repl.JvmReplCompilerState
import org.jetbrains.kotlin.scripting.ide_services.compiler.impl.IdeLikeReplCodeAnalyzer
import org.jetbrains.kotlin.scripting.ide_services.compiler.impl.KotlinResolutionFacadeForRepl

Response:
import org.jetbrains.kotlin.scripting.ide_services.compiler.impl.getKJvmCompletion
import org.jetbrains.kotlin.scripting.ide_services.compiler.impl.prepareCodeForCompletion
import kotlin.script.experimental.api.*
import kotlin.script.experimental.host.ScriptingHostConfiguration<|endoftext|>


Prompt:
fun box(): String {
    val b = A().B()
    if (b.test1() != "A.bar") return "test1 ${b.test1()}"
    if (b.test2() != "B.bar") return "test2 ${b.test2()}"
    if (b.test3() != "B.bar") return "test3 ${b.test3()}"

Response:
if (b.test4() != "A.bar") return "test4 ${b.test4()}"
    if (b.test5() != "B.bar") return "test5 ${b.test5()}"
    if (b.test6() != "B.bar") return "test6 ${b.test6()}"

    return "OK"
}<|endoftext|>


Prompt:
produceHeaderKlib: Boolean = false,
) : KlibMetadataSerializer(languageVersionSettings, metadataVersion, project, exportKDoc, skipExpects, includeOnlyModuleContent, allowErrorTypes, produceHeaderKlib) {

    private fun serializePackageFragment(fqName: FqName, module: ModuleDescriptor): List<ProtoBuf.PackageFragment> {

Response:
val fragments = if (includeOnlyModuleContent) {
            module.packageFragmentProviderForModuleContentWithoutDependencies.packageFragments(fqName)
        } else {
            module.getPackage(fqName).fragments.filter { it.module == module }
        }

        if (fragments.isEmpty()) return emptyList()<|endoftext|>


Prompt:
public inline val RequestCredentials.Companion.SAME_ORIGIN: RequestCredentials get() = "same-origin".asDynamic().unsafeCast<RequestCredentials>()

public inline val RequestCredentials.Companion.INCLUDE: RequestCredentials get() = "include".asDynamic().unsafeCast<RequestCredentials>()

/* please, don't implement this interface! */

Response:
@JsName("null")
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
public external interface RequestCache {
    companion object
}

public inline val RequestCache.Companion.DEFAULT: RequestCache get() = "default".asDynamic().unsafeCast<RequestCache>()<|endoftext|>


Prompt:
return "OK"
}

open class A<O, F> {
    open fun group(): A<F, String> {
        return null!!
    }
    fun <R> apply(instance: A<O, *>, function: (F) -> R): A<O, R> {
        return null!!
    }
    companion object {

Response:
fun <T> create(a: (A<T, T>) -> A<T, T>) {}
    }
}<|endoftext|>


Prompt:
for(i in 1..10) {
        y <!UNRESOLVED_REFERENCE!>+=<!> ""
        y = x
        x.length
        y.length
    }
}

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

Response:
y<!UNRESOLVED_REFERENCE!>++<!>
        y = x
        x.inc()
        y.inc()
    }
}

//Nested loop

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


Prompt:
val FORCE_PARAMETER = Name.identifier("\$force")
    val STABILITY_FLAG = Name.identifier("\$stable")
    val STABILITY_PROP_FLAG = Name.identifier("\$stableprop")
    val DEFAULT_PARAMETER = Name.identifier("\$default")
    val JOINKEY = Name.identifier("joinKey")

Response:
val STARTRESTARTGROUP = Name.identifier("startRestartGroup")
    val ENDRESTARTGROUP = Name.identifier("endRestartGroup")
    val UPDATE_SCOPE = Name.identifier("updateScope")
    val SOURCEINFORMATION = "sourceInformation"
    val SOURCEINFORMATIONMARKERSTART = "sourceInformationMarkerStart"<|endoftext|>


Prompt:
if (!(element3 !in collection.indices) != range0.contains(element3)) throw AssertionError()
}

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

Response:
if (0.toByte() !in collection.indices != !range0.contains(0.toByte())) throw AssertionError()
    if (!(0.toByte() in collection.indices) != !range0.contains(0.toByte())) throw AssertionError()<|endoftext|>


Prompt:
* @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
 */
@SinceKotlin("1.3")
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size): Unit {

Response:
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
    for (index in fromIndex until toIndex) {
        this[index] = element
    }
}

/**
 * Fills this array or its subrange with the specified [element] value.
 *
 * @param fromIndex the start of the range (inclusive) to fill, 0 by default.<|endoftext|>


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

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

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

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


Prompt:
functionTypeConstructor: ConeClassLikeLookupTag,
        arguments: Array<ConeTypeProjection>,
        isNullable: Boolean,
        attributes: ConeAttributes
    ): ConeClassLikeType {
        val result =
            when ((functionTypeConstructor.toSymbol(moduleData.session)?.fir as FirTypeParameterRefsOwner).typeParameters.size - arguments.size) {

Response:
0 -> createSuspendFunctionTypeForBasicCase(functionTypeConstructor, arguments, isNullable, attributes)
                1 -> {
                    val arity = arguments.size - 1
                    if (arity >= 0) {
                        val kind = FunctionTypeKind.SuspendFunction
                        ConeClassLikeTypeImpl(
                            ClassId(kind.packageFqName, kind.numberedClassName(arity)).toLookupTag(),<|endoftext|>


Prompt:
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrFakeOverrideSymbolBase

Response:
import org.jetbrains.kotlin.ir.util.SymbolRemapper
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
import org.jetbrains.kotlin.ir.visitors.acceptVoid

/**<|endoftext|>


Prompt:
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
import org.jetbrains.kotlin.js.translate.context.TranslationContext
import org.jetbrains.kotlin.js.translate.reference.ReferenceTranslator

Response:
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter

class RangeToIntrinsic(function: FunctionDescriptor) : FunctionIntrinsicWithReceiverComputed() {
    val rangeTypeDescriptor = function.returnType!!.constructor.declarationDescriptor as ClassDescriptor<|endoftext|>


Prompt:
// NOTE: This method is used for presenting positions to the user
    override fun toString(): String = if (line < 0) "(offset: $column line unknown)" else "($line,$column)"

    companion object {
        val NONE = KtSourceFileDiagnosticPos(-1, -1, null)
    }
}

Response:
private class SequentialFilePositionFinder private constructor(private val reader: InputStreamReader)
    : Closeable, SequentialPositionFinder(reader)
{
    constructor(file: File) : this(file.reader(/* TODO: select proper charset */))

    override fun close() {
        reader.close()
    }
}

// public only for tests<|endoftext|>


Prompt:
generateCheckersComponents(generationPath, declarationPackage, "FirDeclarationChecker") {
        alias<FirDeclaration>("BasicDeclarationChecker")
        alias<FirCallableDeclaration>("CallableDeclarationChecker")
        alias<FirFunction>("FunctionChecker")
        alias<FirSimpleFunction>("SimpleFunctionChecker")
        alias<FirProperty>("PropertyChecker")

Response:
alias<FirClassLikeDeclaration>("ClassLikeChecker")
        alias<FirClass>("ClassChecker")
        alias<FirRegularClass>("RegularClassChecker")
        alias<FirConstructor>("ConstructorChecker")
        alias<FirFile>("FileChecker")
        alias<FirScript>("ScriptChecker")<|endoftext|>


Prompt:
}
    }

    private fun reportAlternativeSignatureErrors() {
        val bc = analysisResult.bindingContext
        val descriptorsWithErrors = bc.getKeys(JvmBindingContextSlices.LOAD_FROM_JAVA_SIGNATURE_ERRORS)
        if (!descriptorsWithErrors.isEmpty()) {

Response:
val message = StringBuilder("The following Java entities have annotations with wrong Kotlin signatures:\n")
            for (descriptor in descriptorsWithErrors) {
                val declaration = DescriptorToSourceUtils.descriptorToDeclaration(descriptor)
                assert(declaration is PsiModifierListOwner)<|endoftext|>


Prompt:
val backingFieldVal: String = <!EXPECTED_PROPERTY_INITIALIZER!>"no"<!>
    var backingFieldVar: String = <!EXPECTED_PROPERTY_INITIALIZER!>"no"<!>

    val customAccessorVal: String

Response:
<!EXPECTED_DECLARATION_WITH_BODY!>get()<!> = "no"
    var customAccessorVar: String
    <!EXPECTED_DECLARATION_WITH_BODY!>get()<!> = "no"
    <!EXPECTED_DECLARATION_WITH_BODY!>set(value)<!> {}<|endoftext|>


Prompt:
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor

val CallableDescriptor.isSuspendLambda get() = this is AnonymousFunctionDescriptor && this.isSuspend

Response:
val ValueParameterDescriptor.hasSuspendFunctionType get() = returnType?.isSuspendFunctionType == true

val ValueParameterDescriptor.hasFunctionOrSuspendFunctionType get() = returnType?.isFunctionOrSuspendFunctionType == true<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.scopes.CallableCopyTypeCalculator
import org.jetbrains.kotlin.fir.scopes.getDeclaredConstructors
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol

Response:
import org.jetbrains.kotlin.fir.symbols.lazyDeclarationResolver
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
import org.jetbrains.kotlin.metadata.ProtoBuf<|endoftext|>


Prompt:
if (!(-1.0 in 3.0..1.0) != !range1.contains(-1.0)) throw AssertionError()
    if (!(-1.0 !in 3.0..1.0) != range1.contains(-1.0)) throw AssertionError()
    // no local optimizations

Response:
if (element1 in 3.0..1.0 != range1.contains(element1)) throw AssertionError()
    if (element1 !in 3.0..1.0 != !range1.contains(element1)) throw AssertionError()
    if (!(element1 in 3.0..1.0) != !range1.contains(element1)) throw AssertionError()<|endoftext|>


Prompt:
extends AbstractAssertWithOriginWithColumnsAndRows<S, A, D, A, C, CV, R, RV> implements OriginWithColumnsAndRows<C, R>  {

}

// FILE: AbstractValueAssert.java

Response: public abstract class AbstractValueAssert<D extends AbstractDbData<D>, A extends AbstractDbAssert<D, A, C, CV, R, RV>, S extends AbstractSubAssert<D, A, S, V, C, CV, R, RV>, V extends AbstractValueAssert<D, A, S, V, C, CV, R, RV>, C extends AbstractColumnAssert<D, A, C, CV, R,<|endoftext|>


Prompt:
expect(1) { intArrayOf(1, 2, 3).indexOf(2) }
        expect(2) { intArrayOf(1, 2, 3).indexOf(3) }

        expect(-1) { longArrayOf(1, 2, 3).indexOf(0) }
        expect(0) { longArrayOf(1, 2, 3).indexOf(1) }

Response:
expect(1) { longArrayOf(1, 2, 3).indexOf(2) }
        expect(2) { longArrayOf(1, 2, 3).indexOf(3) }

//        expect(-1) { floatArrayOf(1.0f, 2.0f, 3.0f).indexOf(0f) }<|endoftext|>


Prompt:
* HELPERS: enumClasses, contractFunctions
 */

// TESTCASE NUMBER: 1
fun case_1(value_1: EnumClass?) {
    val value_2: Int

    when (value_1) {
        EnumClass.NORTH -> funWithExactlyOnceCallsInPlace { value_2 = 1 }

Response:
EnumClass.SOUTH -> funWithExactlyOnceCallsInPlace { value_2 = 2 }
        EnumClass.WEST -> funWithExactlyOnceCallsInPlace { value_2 = 3 }
        EnumClass.EAST -> funWithExactlyOnceCallsInPlace { value_2 = 4 }
        null -> funWithExactlyOnceCallsInPlace { value_2 = 5 }
    }<|endoftext|>


Prompt:
arguments: List<KtNamedAnnotationValue>,
): SymbolLightAbstractAnnotationParameterList = if (arguments.isNotEmpty()) {
    SymbolLightLazyAnnotationParameterList(this, lazyOf(arguments))
} else {
    symbolLightAnnotationParameterList()
}

internal inline fun SymbolLightAbstractAnnotation.symbolLightAnnotationParameterList(

Response:
crossinline argumentsComputer: () -> List<KtNamedAnnotationValue>,
): SymbolLightAbstractAnnotationParameterList = SymbolLightLazyAnnotationParameterList(this, lazyPub { argumentsComputer() })<|endoftext|>


Prompt:
class FirPlaceholderProjectionBuilder {
    var source: KtSourceElement? = null

    fun build(): FirPlaceholderProjection {
        return FirPlaceholderProjectionImpl(
            source,
        )
    }

}

@OptIn(ExperimentalContracts::class)
inline fun buildPlaceholderProjection(init: FirPlaceholderProjectionBuilder.() -> Unit = {}): FirPlaceholderProjection {

Response:
contract {
        callsInPlace(init, InvocationKind.EXACTLY_ONCE)
    }
    return FirPlaceholderProjectionBuilder().apply(init).build()
}<|endoftext|>


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

Response:
if (!(element19 in 1..3) != !range0.contains(element19)) throw AssertionError()
    if (!(element19 !in 1..3) != range0.contains(element19)) throw AssertionError()
}

fun testR0xE20() {
    // with possible local optimizations<|endoftext|>


Prompt:
abstract <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, PROPERTY_TYPE_MISMATCH_ON_INHERITANCE!>class Test3<!> : IStr by CStr(), IInt by CInt()

abstract class Test4 : IStr by CStr(), IGeneric<String>

abstract class Test5 : IStr by CStr(), IGeneric<Any>

Response:
abstract <!PROPERTY_TYPE_MISMATCH_ON_INHERITANCE!>class Test6<!> : IStr by CStr(), IGeneric<Int>

abstract class Test7 : IGeneric<String> by CGeneric<String>(), IStr<|endoftext|>


Prompt:
import org.jetbrains.kotlin.load.java.NULLABILITY_ANNOTATIONS
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
import org.jetbrains.kotlin.platform.PlatformSpecificDiagnosticComponents

class JvmDiagnosticComponents(
    private val typeQualifierResolver: AnnotationTypeQualifierResolver

Response:
) : PlatformSpecificDiagnosticComponents {
    override fun isNullabilityAnnotation(
        annotationDescriptor: AnnotationDescriptor,
        containingDeclaration: DeclarationDescriptor
    ): Boolean {
        if (containingDeclaration !is JavaCallableMemberDescriptor) {
            return false
        }<|endoftext|>


Prompt:
val enhancePrimitiveArrays: Boolean

    object Default : JavaResolverSettings {
        override val correctNullabilityForNotNullTypeParameter: Boolean
            get() = false

        override val typeEnhancementImprovementsInStrictMode: Boolean
            get() = false

        override val ignoreNullabilityForErasedValueParameters: Boolean
            get() = false

Response:
override val enhancePrimitiveArrays: Boolean
            get() = false
    }

    companion object {
        fun create(
            correctNullabilityForNotNullTypeParameter: Boolean,
            typeEnhancementImprovementsInStrictMode: Boolean,
            ignoreNullabilityForErasedValueParameters: Boolean,
            enhancePrimitiveArrays: Boolean,
        ): JavaResolverSettings =<|endoftext|>


Prompt:
* DESCRIPTION: 'When' with different variants of the arithmetic expressions (additive expression and multiplicative expression) in 'when condition'.
 * HELPERS: typesProvider, classes, functions
 */

// TESTCASE NUMBER: 1
fun case_1(value_1: Any?) {
    when (value_1) {
        true, 100, -.09f -> {}
        '.', "...", null -> {}

Response:
}
}

// TESTCASE NUMBER: 2
fun case_2(value_1: Number, value_2: Int) {
    when (value_1) {
        -.09 % 10L, value_2 / -5, getByte() - 11 + 90 -> {}
    }
}

// TESTCASE NUMBER: 4<|endoftext|>


Prompt:
workingDirFromAnnotation ?: getTestName(false)
        )
        originalProjectDir = projDirPath.toFile()
        workDir = copyTestDataToTmpDir(originalProjectDir)
        orCreateProjectDir
    }

    protected open fun copyTestDataToTmpDir(testDataDir: File): File {

Response:
assert(testDataDir.exists()) { "Cannot find source folder " + testDataDir.absolutePath }
        val tmpDir = FileUtil.createTempDirectory("kjbtb-jps-build", null)
        FileUtil.copyDir(testDataDir, tmpDir)
        return tmpDir
    }

    override fun tearDown() {
        RunAll(<|endoftext|>


Prompt:
swap(i++, j--)
    }

    return i
}

fun check(array: UIntArray, resultAsInt: String, resultAsInner: String) {
    val actualAsInt = StringBuilder()
    val actualAsInner = StringBuilder()
    for (n in array) {
        actualAsInt.append("${n.asInt()} ")

Response:
actualAsInner.append(n.toString() + " ")
    }

    if (actualAsInt.toString() != resultAsInt) {
        throw IllegalStateException("wrong result as int (actual): $actualAsInt ; expected: $resultAsInt")
    }

    if (actualAsInner.toString() != resultAsInner) {<|endoftext|>


Prompt:
if (ann.s != 1.toShort()) return "fail: annotation parameter s should be 1, but was ${ann.s}"
    if (ann.i != 1) return "fail: annotation parameter i should be 1, but was ${ann.i}"
    if (ann.f != 1.toFloat()) return "fail: annotation parameter f should be 1, but was ${ann.f}"

Response:
if (ann.d != 1.0) return "fail: annotation parameter d should be 1, but was ${ann.d}"
    if (ann.l != 1.toLong()) return "fail: annotation parameter l should be 1, but was ${ann.l}"
    if (ann.c != 'c') return "fail: annotation parameter c should be 1, but was ${ann.c}"<|endoftext|>


Prompt:
public actual operator fun CharArray.plus(elements: Collection<Char>): CharArray {
    var index = size
    val result = this.copyOf(size + elements.size)
    for (element in elements) result[index++] = element
    return result
}

/**
 * Returns an array containing all elements of the original array and then all elements of the given [elements] array.
 */

Response:
@Suppress("ACTUAL_WITHOUT_EXPECT", "NOTHING_TO_INLINE")
public actual inline operator fun <T> Array<out T>.plus(elements: Array<out T>): Array<T> {
    return this.asDynamic().concat(elements)
}

/**
 * Returns an array containing all elements of the original array and then all elements of the given [elements] array.<|endoftext|>


Prompt:
constructor.transformDelegatedConstructor(transformer, data)
            context.forConstructorBody(constructor, session) {
                constructor.transformBody(transformer, data)
            }
        }

        val controlFlowGraphReference = dataFlowAnalyzer.exitFunction(constructor)
        constructor.replaceControlFlowGraphReference(controlFlowGraphReference)
        return constructor
    }

Response:
override fun transformMultiDelegatedConstructorCall(
        multiDelegatedConstructorCall: FirMultiDelegatedConstructorCall,
        data: ResolutionMode,
    ): FirStatement {
        multiDelegatedConstructorCall.transformChildren(this, data)
        return super.transformMultiDelegatedConstructorCall(multiDelegatedConstructorCall, data)
    }<|endoftext|>


Prompt:
* Returns whether this [FirScope] is a scope wider than [another] based on the above [PartialOrderOfScope] or not.
     */
    private fun FirScope.isWiderThan(another: FirScope): Boolean =
        toPartialOrder().scopeDistanceLevel > another.toPartialOrder().scopeDistanceLevel

    /**

Response:
* Assuming that all scopes in this List<FirScope> and [base] are surrounding [from], returns whether an element of
     * this List<FirScope> is closer than [base] based on the distance from [from].
     */
    private fun List<FirScope>.hasScopeCloserThan(base: FirScope, from: KtElement) = any { scope -><|endoftext|>


Prompt:
"kotlin.arrayOf", "kotlin.byteArrayOf", "kotlin.charArrayOf", "kotlin.shortArrayOf", "kotlin.intArrayOf",
            "kotlin.longArrayOf", "kotlin.floatArrayOf", "kotlin.doubleArrayOf", "kotlin.booleanArrayOf"
        )
    }

Response:
override fun evaluate(irFunction: IrFunction, environment: IrInterpreterEnvironment) {
        val elementsSymbol = irFunction.valueParameters.single().symbol
        val varargVariable = environment.callStack.loadState(elementsSymbol)
        environment.callStack.pushState(varargVariable)
    }
}

internal object ArrayOfNulls : IntrinsicBase() {<|endoftext|>


Prompt:
add(FirJsErrors.JS_NAME_ON_PRIMARY_CONSTRUCTOR_PROHIBITED) { firDiagnostic ->
        JsNameOnPrimaryConstructorProhibitedImpl(
            firDiagnostic as KtPsiDiagnostic,
            token,
        )
    }

Response:
add(FirJsErrors.JS_NAME_ON_ACCESSOR_AND_PROPERTY) { firDiagnostic ->
        JsNameOnAccessorAndPropertyImpl(
            firDiagnostic as KtPsiDiagnostic,
            token,
        )
    }<|endoftext|>


Prompt:
private fun ExportModelGenerator.generateExportWithExternals(irFiles: Collection<IrFile>): List<IrFileExports> {
        return irFiles.map { irFile ->
            val exports = generateExport(irFile)
            val additionalExports = backendContext.externalPackageFragment[irFile.symbol]?.let { generateExport(it) } ?: emptyList()

Response:
val allExports = additionalExports + exports
            val tsDeclarations = runIf(shouldGenerateTypeScriptDefinitions) {
                allExports.ifNotEmpty { toTypeScriptFragment(moduleKind) }
            }
            IrFileExports(irFile, allExports, tsDeclarations)
        }
    }<|endoftext|>


Prompt:
// Enable when callable references to builtin members and using lambdas as extension lambdas (KT-13312) is supported
// FILE: 1.kt

package test

inline fun call(p: String, s: String.() -> Int): Int {
    return p.s()
}

// FILE: 2.kt

import test.*

fun box() : String {

Response:
return if (call("123", String::length) == 3) "OK" else "fail"
}<|endoftext|>


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

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, this_\43:MyClass=MyClass, $i$f$f2\43\477:int=0:int, $i$f$test\44\491:int=0:int<|endoftext|>


Prompt:
val matchResult = moduleDirectiveRegex.matchEntire(moduleDirectiveString)
                ?: error("\"$moduleDirectiveString\" doesn't matches with pattern \"moduleName(dep1, dep2)\"")
            val (name, _, dependencies, _, friends, _, dependsOn) = matchResult.destructured

Response:
var dependenciesNames = dependencies.takeIf { it.isNotBlank() }?.split(" ") ?: emptyList()
            globalDirectives?.let { directives ->
                /*
                 * In old tests coroutine helpers was added as separate module named `support`
                 *   instead of additional files for current module. So to safe compatibility with
                 *   old testdata we need to filter this dependency
                 */<|endoftext|>


Prompt:
enhanceConeKotlinType(session, qualifiers, 0, mutableListOf<Int>().apply { computeSubtreeSizes(this) }, convertErrorsToWarnings = false)

// The index in the lambda is the position of the type component in a depth-first walk of the tree.

Response:
// Example: A<B<C, D>, E<F>> - 0<1<2, 3>, 4<5>>. For flexible types, some arguments in the lower bound
// may be replaced with star projections in the upper bound, but otherwise corresponding arguments<|endoftext|>


Prompt:
public external abstract class SVGMaskElement : SVGElement, SVGUnitTypes, JsAny {
    open val maskUnits: SVGAnimatedEnumeration
    open val maskContentUnits: SVGAnimatedEnumeration
    open val x: SVGAnimatedLength
    open val y: SVGAnimatedLength
    open val width: SVGAnimatedLength
    open val height: SVGAnimatedLength

    companion object {

Response:
val SVG_UNIT_TYPE_UNKNOWN: Short
        val SVG_UNIT_TYPE_USERSPACEONUSE: Short
        val SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: Short
        val ELEMENT_NODE: Short
        val ATTRIBUTE_NODE: Short
        val TEXT_NODE: Short
        val CDATA_SECTION_NODE: Short<|endoftext|>


Prompt:
* Parses the string as an [UInt] number and returns the result
 * or `null` if the string is not a valid representation of a number.
 *
 * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
 */
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)

Response:
public fun String.toUIntOrNull(radix: Int): UInt? {
    checkRadix(radix)

    val length = this.length
    if (length == 0) return null

    val limit: UInt = UInt.MAX_VALUE
    val start: Int

    val firstChar = this[0]
    if (firstChar < '0') {<|endoftext|>


Prompt:
return callee.valueParameters.singleOrNull()?.type in progressionElementTypes &&
                callee.extensionReceiverParameter?.type in progressionElementTypes &&
                callee.kotlinFqName == FqName("kotlin.ranges.until")
    }

    override fun build(expression: IrCall, data: ProgressionType, scopeOwner: IrSymbol): HeaderInfo? =

Response:
with(context.createIrBuilder(scopeOwner, expression.startOffset, expression.endOffset)) {
            ProgressionHeaderInfo(
                data,
                first = expression.extensionReceiver!!,
                last = expression.getValueArgument(0)!!,
                step = irInt(1),
                canOverflow = false,
                isLastInclusive = false,<|endoftext|>


Prompt: "\u1F0A\u0399", "\u1F0B\u0399", "\u1F0C\u0399",

Response: "\u1F0D\u0399", "\u1F0E\u0399", "\u1F0F\u0399", "\u1F08\u0399", "\u1F09\u0399", "\u1F0A\u0399", "\u1F0B\u0399", "\u1F0C\u0399",<|endoftext|>


Prompt:
byteBufferStartIndex += 1
            resetByteBufferIfEmpty()
            return byte
        }
        return when (read(singleByteBuffer, 0, 1)) {
            -1 -> -1
            1 -> singleByteBuffer[0].toInt() and 0xFF
            else -> error("Unreachable")
        }
    }

Response:
override fun read(destination: ByteArray, offset: Int, length: Int): Int {
        if (offset < 0 || length < 0 || offset + length > destination.size) {
            throw IndexOutOfBoundsException("offset: $offset, length: $length, buffer size: ${destination.size}")
        }
        if (isClosed) {
            throw IOException("The input stream is closed.")<|endoftext|>


Prompt:
package org.jetbrains.kotlin.ir.overrides

import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.ir.declarations.*

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


Prompt:
fun <A: Int, B: Float> eqIntFloat(a: A, b: B) = a == b
fun <A: Int, B: Float?> eqIntFloatQ(a: A, b: B) = a == b
fun <A: Int?, B: Float> eqIntQFloat(a: A, b: B) = a == b

Response:
fun <A: Int?, B: Float?> eqIntQFloatQ(a: A, b: B) = a == b
fun <A: Int, B: Double> eqIntDouble(a: A, b: B) = a == b
fun <A: Int, B: Double?> eqIntDoubleQ(a: A, b: B) = a == b<|endoftext|>


Prompt:
print("forEach { it")
                                if (child.baseType.nullable) {
                                    print("?")
                                }
                                println(".accept(visitor, data) }")
                            }
                        }
                    }
                }
            } else {
                println()
            }
        }

        if (element.hasTransformChildrenMethod) {
            printTransformChildrenMethod(
                element = element,

Response:
transformerClass = elementTransformerType,
                returnType = StandardTypes.unit,
                override = !element.isRootElement,
            )
            if (!element.isRootElement) {
                printBlock {
                    for (child in element.transformableChildren) {
                        print(child.name)
                        when (child) {
                            is SingleField -> {<|endoftext|>


Prompt:
UBInfo(0x1100, 0x11FF, "HangulJamo"), // Character.UnicodeBlock.HANGUL_JAMO
            /* 1200; 137F; Ethiopic */
            UBInfo(0x1200, 0x137F, "Ethiopic"), // Character.UnicodeBlock.ETHIOPIC
            /* 13A0; 13FF; Cherokee */

Response:
UBInfo(0x13A0, 0x13FF, "Cherokee"), // Character.UnicodeBlock.CHEROKEE
            /* 1400; 167F; Unified Canadian Aboriginal Syllabics */<|endoftext|>


Prompt:
* Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.
 *
 * @param startIndex the beginning (inclusive) of the subrange to decode, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to decode, size of this array by default.

Response:
* @param throwOnInvalidSequence specifies whether to throw an exception on malformed byte sequence or replace it by the replacement char `\uFFFD`.
 *
 * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the size of this array.
 * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].<|endoftext|>


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

package org.jetbrains.kotlin.fir.expressions

import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.fir.FirElement

Response:
import org.jetbrains.kotlin.fir.FirTarget
import org.jetbrains.kotlin.fir.FirTargetElement
import org.jetbrains.kotlin.fir.types.ConeKotlinType
import org.jetbrains.kotlin.fir.visitors.FirTransformer<|endoftext|>


Prompt:
val CompilerOutputKind.isHeaderCache: Boolean
    get() = this == CompilerOutputKind.HEADER_CACHE

val CompilerOutputKind.isCache: Boolean
    get() = this.isFullCache || this.isHeaderCache

internal fun produceCStubs(generationState: NativeGenerationState) {
    generationState.cStubsManager.compile(
            generationState.config.clang,

Response:
generationState.messageCollector,
            generationState.inVerbosePhase
    ).forEach {
        parseAndLinkBitcodeFile(generationState, generationState.llvm.module, it.absolutePath)
    }
}

private data class LlvmModules(
        val runtimeModules: List<LLVMModuleRef>,
        val additionalModules: List<LLVMModuleRef>
)

/**<|endoftext|>


Prompt:
// TARGET_BACKEND: JVM
// FIR_IDENTICAL
// FILE: JavaAnn.java
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
@interface JavaAnn {
    String value() default "";
    int i() default 0;
}

// FILE: javaAnnotation.kt

Response:
@JavaAnn fun test1() {}

@JavaAnn(value="abc", i=123) fun test2() {}

@JavaAnn(i=123, value="abc") fun test3() {}<|endoftext|>


Prompt:
to.autoCacheDir = from.autoCacheDir
    to.autoCacheableFrom = from.autoCacheableFrom?.copyOf()
    to.backendThreads = from.backendThreads
    to.binaryOptions = from.binaryOptions?.copyOf()
    to.bundleId = from.bundleId
    to.cacheDirectories = from.cacheDirectories?.copyOf()

Response:
to.cachedLibraries = from.cachedLibraries?.copyOf()
    to.checkDependencies = from.checkDependencies
    to.checkExternalCalls = from.checkExternalCalls
    to.clangOptions = from.clangOptions?.copyOf()
    to.compileFromBitcode = from.compileFromBitcode
    to.debug = from.debug<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>y<!>
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.length
        }
    }
    constructor(y: Int?) : this() {
        println(y)

Response:
}
    constructor(y: Int?, z: Int?) : this() {
        println(y)
    }
}

/*
 * TESTCASE NUMBER: 8
 * UNEXPECTED BEHAVIOUR
 * ISSUES: KT-17694
 */
class Case8 {
    init {
        var y: String? = "xyz"
        y!!<|endoftext|>


Prompt:
* Available at https://www.jstatsoft.org/v08/i14/paper
 *
 */
internal class XorWowRandom internal constructor(
    private var x: Int,
    private var y: Int,
    private var z: Int,
    private var w: Int,
    private var v: Int,
    private var addend: Int
) : Random(), Serializable {

Response:
internal constructor(seed1: Int, seed2: Int) :
            this(seed1, seed2, 0, 0, seed1.inv(), (seed1 shl 10) xor (seed2 ushr 4))

    init {
        require((x or y or z or w or v) != 0) { "Initial state must have at least one non-zero element." }<|endoftext|>


Prompt:
import kotlin.script.experimental.dependencies.impl.makeExternalDependenciesResolverOptions

class ResolverOptionsTest : TestCase() {
    fun testValueInMapAppearsIfPresent() {
        val map = mapOf("option" to "value")
        val options = makeExternalDependenciesResolverOptions(map)

        assertEquals(options.value("option"), "value")
    }

Response:
fun testFlagInMapAppearsIfPresent() {
        val map = mapOf("option" to "true")
        val options = makeExternalDependenciesResolverOptions(map)

        assertEquals(options.value("option"), "true")
        assertEquals(options.flag("option"), true)
    }

    fun testValueInMapDoesNotAppearsIfPresent() {<|endoftext|>


Prompt:
// FIR_IGNORE
// KNM_K2_IGNORE
// Ignore reason: FIR does not support nested typealiases (especially inside inner classes)
package test

import dependency.*
import kotlin.annotation.AnnotationTarget

class Outer<E, F> {
    inner class Inner<G> {
        @Suppress("TOPLEVEL_TYPEALIASES_ONLY")

Response:
typealias TA<H> = Map<Map<E, F>, Map<G, H>>
    }
}

@Target(AnnotationTarget.TYPEALIAS)
annotation class Ann

class TypeAliases {

    class OrderB

    @Suppress("TOPLEVEL_TYPEALIASES_ONLY")
    typealias B = (A) -> Unit<|endoftext|>


Prompt:
* UNEXPECTED BEHAVIOUR
 * ISSUES: KT-37179
 */
package testsCase2
import libPackageCase2.*
import libPackageCase2Explicit.emptyArray

class Case2(){

    fun case1_0() {
        fun <T> Case2.emptyArray(): Array<T> = TODO()

Response:
<!DEBUG_INFO_CALL("fqName: testsCase2.Case2.case1_0.emptyArray; typeCall: extension function")!>emptyArray<Int>()<!>

        fun case1_1() {
            fun <T> Case2.emptyArray(): Array<T> = TODO()<|endoftext|>


Prompt:
final override fun visitElseBranch(branch: IrElseBranch): IrElseBranch = super.visitElseBranch(branch)
    final override fun visitLoop(loop: IrLoop) = super.visitLoop(loop)
    final override fun visitWhileLoop(loop: IrWhileLoop) = super.visitWhileLoop(loop)

Response:
final override fun visitDoWhileLoop(loop: IrDoWhileLoop) = super.visitDoWhileLoop(loop)
    final override fun visitTry(aTry: IrTry) = super.visitTry(aTry)
    final override fun visitCatch(aCatch: IrCatch): IrCatch = super.visitCatch(aCatch)<|endoftext|>


Prompt:
* Time marks returned by this time source can be compared for difference with other time marks
 * obtained from the same time source.
 *
 * @property unit The unit in which this time source's readings are expressed.
 */
@SinceKotlin("1.9")
@WasExperimental(ExperimentalTime::class)
public abstract class AbstractLongTimeSource(protected val unit: DurationUnit) : TimeSource.WithComparableMarks {
    /**

Response:
* This protected method should be overridden to return the current reading of the time source expressed as a [Long] number
     * in the unit specified by the [unit] property.
     *
     * Note that the value returned by this method when [markNow] is called the first time is used as "zero" reading
     * and the difference from this "zero" reading is calculated for subsequent values.<|endoftext|>


Prompt:
else ->
                return super.visitFunctionAccess(expression)
        }
        return super.visitExpression(modifyFunctionAccessExpression(expression, accessor))
    }

    private fun handleLambdaMetafactoryIntrinsic(call: IrCall, thisSymbol: IrClassSymbol?): IrExpression {

Response:
val implFunRef = call.getValueArgument(1) as? IrFunctionReference
            ?: throw AssertionError("'implMethodReference' is expected to be 'IrFunctionReference': ${call.dump()}")
        val implFunSymbol = implFunRef.symbol

        if (implFunSymbol.isAccessibleFromSyntheticProxy(thisSymbol))
            return call<|endoftext|>


Prompt:
val v = InstructionAdapter(node)
    val returnLabel = Label()

    // if (!condition)
    v.load(0, Type.BOOLEAN_TYPE)
    v.ifne(returnLabel)
    if (functionDescriptor.isBuiltinAlwaysEnabledAssertWithLambda()) {
        // val err = AssertionError(lambda())

Response:
v.load(1, Type.getObjectType(LAMBDA_INTERNAL_NAME))
        v.invokeinterface(LAMBDA_INTERNAL_NAME, "invoke", "()Ljava/lang/Object;")
        v.store(2, AsmTypes.OBJECT_TYPE)
        v.anew(Type.getObjectType(ASSERTION_ERROR_INTERNAL_NAME))<|endoftext|>


Prompt:
// FILE: b.kt
package p

public interface B {
    public fun foo(a: Int, b: String, c: Int = 0): B?
}

// MODULE: m4(m3, m2)
// FILE: c.kt
import p.*

fun test(b: B?) {
    if (b is C) {

Response:
b<!UNNECESSARY_SAFE_CALL!>?.<!>foo(1, "")
    }
}<|endoftext|>


Prompt:
runWithKotlinc("$TEST_DATA_DIR/integration/intResult.kts", listOf("10"))
    }

    @Test
    fun testStandardScriptWithDeps() {
        runWithK2JVMCompiler(
            "$TEST_DATA_DIR/integration/withDependencyOnCompileClassPath.kts", listOf("Hello from standard kts!"),

Response:
classpath = getMainKtsClassPath()
        )
    }

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


Prompt:
expect fun f1()

expect fun f2(name: String)

expect fun f3(name: String)
expect fun String.f3ext()

expect fun f4(name: String)

expect fun String.f5()

expect fun f6(p1: String, p2: Int)

expect fun <T> f7()

internal expect fun f8()

Response:
public expect fun f10()

expect fun <T : Number> f11()
expect fun <U : MutableList<String>> f12()
expect fun <A, B : Comparable<A>> f13()

expect inline fun <X> f14()
expect inline fun <reified Y> f15()

expect fun f16(s: String)<|endoftext|>


Prompt:
fun `test - default resources task names are consistent`() {
        val project = buildProjectWithJvm()
        val jvmTarget = project.kotlinExtension.targets.single()
        val expectedProcessResourceTaskNames = setOf("processResources", "processTestResources")
        val actualProcessResourceTaskNames = project.tasks.withType<ProcessResources>().names

Response:
val kotlinReportedProcessResourceTaskNames = hashSetOf<String>()
        for (compilation in jvmTarget.compilations) {
            val processResourcesTaskName = (compilation as? InternalKotlinCompilation<*>)?.processResourcesTaskName
            if (processResourcesTaskName != null) {
                kotlinReportedProcessResourceTaskNames.add(processResourcesTaskName)
            }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer

@PhaseDescription(
    name = "Assertion",
    description = "Lower assert calls depending on the assertions mode",
    // Necessary to place the `$assertionsDisabled` field into the reference's class, not the
    // class that contains it.
    prerequisite = [FunctionReferenceLowering::class]
)

Response:
internal class AssertionLowering(private val context: JvmBackendContext) :
    FileLoweringPass,
    IrElementTransformer<AssertionLowering.ClassInfo?> {
    // Keeps track of the $assertionsDisabled field, which we generate lazily for classes containing
    // assertions when compiled with -Xassertions=jvm.<|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")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly<|endoftext|>


Prompt:
public interface KotlinCompositeProvider<P : KotlinComposableProvider> : KotlinComposableProvider {
    public val providers: List<P>
}

public interface KotlinComposableProviderMerger<P : KotlinComposableProvider> {
    /**
     * Merges the given [providers] into a single provider. When possible, mergers will try to create a provider that is more efficient

Response:
* compared to the naive sequential composite provider. Not all providers might be mergeable, or there might be multiple separate sets
     * of providers that can be merged individually, so the resulting provider may be a composite provider.
     */
    public fun merge(providers: List<P>): P
}<|endoftext|>


Prompt:
val OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION_FQ_NAME = OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION_CLASS_ID.asSingleFqName()

// @HidesMembers annotation only has effect for members with these names

Response: val HIDES_MEMBERS_NAME_LIST = setOf(Name.identifier("forEach"), Name.identifier("addSuppressed"))<|endoftext|>


Prompt:
return analyze(module) {
        val sirSession = StandaloneSirSession(this) { _, _ ->
            SirSingleModuleProvider(swiftModuleName = input.name, bridgeModuleName = bridgeModuleName)
        }
        with(sirSession) {
            module.sirModule().also {
                scopeProvider(this@analyze).flatMap { scope ->
                    scope.extractDeclarations()

Response:
}.forEach { topLevelDeclaration ->
                    val parent = topLevelDeclaration.parent as? SirMutableDeclarationContainer
                        ?: error("top level declaration can contain only module or extension to package as a parent")
                    parent.addChild { topLevelDeclaration }
                }
            }
        }
    }
}

private data class ModuleWithScopeProvider(
    val ktModule: KtModule,<|endoftext|>


Prompt:
import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.util.constructedClass
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid

Response:
class WasmArrayConstructorLowering(val context: WasmBackendContext) : BodyLoweringPass {
    override fun lower(irBody: IrBody, container: IrDeclaration) {
        irBody.transformChildrenVoid(WasmArrayConstructorTransformer(context, container as IrSymbolOwner))
    }
}

private class WasmArrayConstructorTransformer(<|endoftext|>


Prompt:
fun renderValueParameter(valueParameter: KmValueParameter, printer: Printer): Unit = with(printer) {
        appendAnnotations(valueParameter.hasAnnotations, getAnnotations(valueParameter), onePerLine = false)
        appendFlags(
            valueParameter.isCrossinline to "crossinline",
            valueParameter.isNoinline to "noinline"
        )

Response:
val varargElementType = valueParameter.varargElementType
        if (varargElementType != null) {
            append("vararg ", valueParameter.name, ": ").appendType(varargElementType)
            append(" /* ").appendType(valueParameter.type).append(" */")
        } else {
            append(valueParameter.name, ": ").appendType(valueParameter.type)
        }<|endoftext|>


Prompt:
infix operator fun plusAssign(c: C) {
        f1 = true
        print("1")
    }

    infix operator fun plus(c: C): C {
        f2 = true
        print("2")
        return c
    }
}

infix operator fun B?.plusAssign(c: C) {
    f3 = true
    print("3")
}

Response:
infix operator fun B?.plusAssign(c: Any) {
    f4 = true
    print("4")
}

class C<|endoftext|>


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

import kotlin.test.assertEquals

interface IFoo {
    fun foo(s: String): String
}

OPTIONAL_JVM_INLINE_ANNOTATION
value class Z<T: Int>(val x: T) : IFoo {

Response:
override fun foo(s: String): String = x.toString() + s
}

class Test(x: Int) : IFoo by Z(x)

fun box(): String {
    assertEquals("1OK", Test(1).foo("OK"))

    return "OK"
}<|endoftext|>


Prompt:
body.buildInstr(WasmOp.CALL_REF, location, WasmImmediate.TypeIdx(context.referenceFunctionType(function.symbol)))
                body.commentGroupEnd()
            } else {
                val symbol = klass.symbol
                if (symbol in hierarchyDisjointUnions) {
                    generateExpression(call.dispatchReceiver!!)

Response:
body.commentGroupStart { "interface call: ${function.fqNameWhenAvailable}" }
                    body.buildStructGet(context.referenceGcType(irBuiltIns.anyClass), WasmSymbol(1), location)

                    val classITableReference = context.referenceClassITableGcType(symbol)
                    body.buildRefCastStatic(classITableReference, location)<|endoftext|>


Prompt:
val facadeNameToId = mutableMapOf<String, Int>()
                writePartsWithinPackage(partsWithinPackage, facadeNameToId)
                writePartsOutsidePackage(partsOutsidePackage, facadeNameToId, builder)
                writeMultifileFacadeNames(facadeNameToId)
            })
        }

        if (metadataParts.isNotEmpty()) {

Response:
builder.addMetadataParts(JvmModuleProtoBuf.PackageParts.newBuilder().apply {
                packageFqName = this@PackageParts.packageFqName
                addAllShortClassName(metadataParts.sorted())
            })
        }
    }

    private fun JvmModuleProtoBuf.PackageParts.Builder.writePartsWithinPackage(
        parts: List<String>,<|endoftext|>


Prompt:
}

fun test() {
    val lf1: context(C) R.(Param) -> Unit = { _ ->
        r
        c
    }
    val lf2: context(C) (Param) -> Unit = { _ ->
        c
    }
    val lf3: context(C) R.() -> Unit = {
        r
        c
    }

Response:
val lf4: context(C) () -> Unit = {
        c
    }

    with(C()) {
        with(R()) {
            f1(lf1)
            f1 { _ ->
                r
                c
            }

            f2(lf2)
            f2 { _ ->
                c
            }

            f3(lf3)
            f3 {
                r<|endoftext|>


Prompt:
return ConeSubstitutorByMap.create(mapping, session)
}

fun FirRegularClassSymbol.getSuperClassSymbolOrAny(session: FirSession): FirRegularClassSymbol {
    for (superType in resolvedSuperTypes) {
        val symbol = superType.fullyExpandedType(session).toRegularClassSymbol(session) ?: continue

Response:
if (symbol.classKind == ClassKind.CLASS) return symbol
    }
    return session.builtinTypes.anyType.type.toRegularClassSymbol(session) ?: error("Symbol for Any not found")
}

fun FirClassLikeSymbol<*>.getSuperTypes(
    useSiteSession: FirSession,
    recursive: Boolean = true,
    lookupInterfaces: Boolean = true,<|endoftext|>


Prompt:
// WITH_STDLIB

/*
 * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
 *
 * SPEC VERSION: 0.1-213
 * MAIN LINK: type-system, type-kinds, built-in-types, kotlin.nothing -> paragraph 1 -> sentence 1
 * NUMBER: 1
 * DESCRIPTION: todo
 */

fun box(): String {

Response:
val b : Nothing?= null
    try {
        val a: Int = b!!
    } catch (e: NullPointerException) {
        return "OK"
    }
    return "NOK"
}<|endoftext|>


Prompt:
context.irBuiltIns.intType,
        context.irBuiltIns.longType,
        context.irBuiltIns.floatType,
        context.irBuiltIns.doubleType,
        context.irBuiltIns.nothingType,
        context.irBuiltIns.nothingNType,
        context.wasmSymbols.voidType -> null
        else -> when {

Response:
isBuiltInWasmRefType(this) -> null
            erasedUpperBound?.isExternal == true -> null
            else -> when (val ic = context.inlineClassesUtils.getInlinedClass(this)) {
                null -> this
                else -> context.inlineClassesUtils.getInlineClassUnderlyingType(ic).getInlinedValueTypeIfAny()
            }
        }
    }<|endoftext|>


Prompt:
fun <T> bindWhen(r: Option<T>): Option<T> {
    return when (r) {
        is Some -> {
            // Works correctly
            if (true) None() else r
        }
        else -> r
    }
}

interface SimpleOption
class SimpleSome : SimpleOption
class SimpleNone : SimpleOption

fun bindNoGeneric(r: SimpleOption): SimpleOption {

Response:
return if (r is SimpleSome) {
        (if (true) SimpleNone() else r) checkType { _<SimpleOption>() }
        if (true) SimpleNone() else r
    }
    else r
}<|endoftext|>


Response: // library.kt:19 box: m:int=1:int, $i$f$foo:int=0:int, fooVar$iv:int=100:int, x1Var\1$iv:int=1:int, $i$f$x1\1\7:int=0:int, y1\1$iv:int=1:int, x2Var\2$iv:int=2:int,<|endoftext|>


Prompt:
var sourceSetTreeClassifier: SourceSetTreeClassifier = SourceSetTreeClassifier.Default
    var sourceSetTreeClassifierV2: KotlinSourceSetTreeClassifier? = null

    internal var configure: ((T) -> Unit)? = null

    fun configure(action: (T) -> Unit) = apply {
        val configure = this.configure
        if (configure == null) this.configure = action

Response:
else this.configure = { configure(it); action(it) }
    }
}

private data class ExternalKotlinCompilationDescriptorImpl<T : DecoratedExternalKotlinCompilation>(
    override val compilationName: String,
    override val compileTaskName: String?,
    override val compileAllTaskName: String?,
    override val defaultSourceSet: KotlinSourceSet,<|endoftext|>


Prompt:
return "${typeTranslator.translateType(signature[0])} (*${signature[0].name})(${signature.drop(1).map { "${typeTranslator.translateType(it)} ${it.name}" }.joinToString(", ")});"
    }

    fun makeTopLevelFunctionString(): Pair<String, String> {
        val signature = makeCFunctionSignature(false)

Response:
val name = signature[0].name
        return (name to
                "extern ${typeTranslator.translateType(signature[0])} $name(${signature.drop(1).map { "${typeTranslator.translateType(it)} ${it.name}" }.joinToString(", ")});")
    }

    fun makeFunctionDeclaration(): String {
        assert(isFunction)<|endoftext|>


Prompt:
final override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
        if (descriptor !is ClassDescriptor) return

        checkMetaSerializableApplicable(descriptor, context.trace)
        checkInheritableSerialInfoNotRepeatable(descriptor, context.trace)
        checkEnum(descriptor, declaration, context.trace)

Response:
checkExternalSerializer(descriptor, declaration, context.trace)

        if (!canBeSerializedInternally(descriptor, declaration, context.trace)) return
        if (declaration !is KtPureClassOrObject) return
        if (!isIde) {
            // In IDE, BindingTrace is recreated each time code is modified, effectively resulting in JAR manifest read every time user types<|endoftext|>


Prompt:
// Only if a subject for memory management.
                            .forEach { irField ->
                                if (irField.type.binaryTypeIsReference() && irField.storageKind(context) != FieldStorageKind.THREAD_LOCAL) {
                                    val address = staticFieldPtr(irField, functionGenerationContext)
                                    storeHeapRef(codegen.kNullObjHeaderPtr, address)
                                }
                            }

Response:
state.globalSharedObjects.forEach { address ->
                        storeHeapRef(codegen.kNullObjHeaderPtr, address)
                    }
                    state.globalInitState?.let {
                        store(llvm.int32(FILE_NOT_INITIALIZED), it)
                    }
                    ret(null)
                }
            }
        }
    }

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


Prompt:
builder.configureForKotlinxSerialization(target = TargetBackend.JS_IR)
    }
}

open class AbstractSerializationFirJsBoxTest : AbstractFirJsTest(
    pathToTestDir = "plugins/kotlinx-serialization/testData/boxIr/",
    testGroupOutputDirPrefix = "codegen/serializationBoxFir/"
) {

Response:
override fun configure(builder: TestConfigurationBuilder) {
        super.configure(builder)
        builder.configureForKotlinxSerialization(target = TargetBackend.JS_IR)
    }
}<|endoftext|>


Prompt:
val compilerArguments = makeScriptCompilerArguments(scriptDefinition.compilerOptions.toList())
            val commandLineProcessors = listOf(AssignmentCommandLineProcessor())
            val compilerConfiguration = CompilerConfiguration()
            processCompilerPluginsOptions(
                compilerConfiguration, compilerArguments.pluginOptions?.asIterable() ?: emptyList(), commandLineProcessors
            )

Response:
val extensionRegistrar = FirScriptingCompilerExtensionIdeRegistrar(
                project,
                hostConfiguration,
                scriptDefinitionSources = emptyList(),
                scriptDefinitions = listOf(scriptDefinition)
            )

            registerExtensions(extensionRegistrar.configure())
            registerExtensions(FirScriptingSamWithReceiverExtensionRegistrar().configure())<|endoftext|>


Prompt:
while (matcher.find()) {
            val effectiveOffset = matcher.start() - offsetCompensation
            val matchedText = matcher.group()
            if (matchedText == "<!>") {
                opened.pop().end = effectiveOffset
            } else {
                val diagnosticTypeMatcher = individualDiagnosticPattern.matcher(matchedText)
                val range = DiagnosedRange(effectiveOffset)

Response:
while (diagnosticTypeMatcher.find())
                    range.addDiagnostic(diagnosticTypeMatcher.group())
                opened.push(range)
                ranges.add(range)
            }
            offsetCompensation += matchedText.length
        }

        assert(opened.isEmpty()) { "Stack is not empty" }

        matcher.reset()<|endoftext|>


Prompt:
typealias DiagnosticsMap = Multimap<FirFile, DiagnosticWithKmpCompilationMode, List<DiagnosticWithKmpCompilationMode>>

data class DiagnosticWithKmpCompilationMode(val diagnostic: KtDiagnostic, val kmpCompilationMode: KmpCompilationMode)

/**
 * There are two types of checkers (represented by [MppCheckerKind]):

Response:
* 1. Common checker. When a common checker analyzes a code, the checker doesn't see what are the actualizations for the `expect` declarations.
 * 2. Platform checker. When a platform checker analyzes a code, the checker sees what are the actualizations for the `expect` declarations
 *    instead of the `expect` declarations themselves.
 *<|endoftext|>


Prompt:
if (position != -1) { //If this is a string with a package after
                    if (completionText[position - 1] == ' ') {
                        position -= 2
                    }
                    //if this is a method without args
                    if (completionText[position + 1] == ')') {
                        position++
                    }
                    completionText = completionText.substring(0, position + 1)
                }

Response:
position = completionText.indexOf(":")
                if (position != -1) {
                    completionText = completionText.substring(0, position - 1)
                }
            }

            return DescriptorPresentation(
                rawDescriptorName,
                presentableText,
                tailText,
                completionText
            )
        }
    }
}<|endoftext|>


Prompt:
val project = Project(projectName, wrapperVersion, directoryPrefix = directoryPrefix)
        project.setupWorkingDir()
        project.configureSingleNativeTarget()
        project.gradleProperties().apply {
            configureJvmMemory()
            disableKotlinNativeCaches()
        }
        return project
    }

    internal fun transformNativeTestProjectWithPluginDsl(
        projectName: String,

Response:
wrapperVersion: GradleVersionRequired = defaultGradleVersion,
        directoryPrefix: String? = null,
    ): BaseGradleIT.Project {
        val project = transformProjectWithPluginsDsl(projectName, wrapperVersion, directoryPrefix = directoryPrefix)
        project.configureSingleNativeTarget()
        project.gradleProperties().apply {
            configureJvmMemory()<|endoftext|>


Prompt:
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModule
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleResolver

class CliJavaModuleResolver(
    private val moduleGraph: JavaModuleGraph,

Response:
private val userModules: List<JavaModule>,
    private val systemModules: List<JavaModule.Explicit>,
    private val project: Project
) : JavaModuleResolver {
    init {
        assert(userModules.count(JavaModule::isSourceModule) <= 1) {
            "Modules computed by ClasspathRootsResolver cannot have more than one source module: $userModules"
        }<|endoftext|>


Prompt:
// TODO: Replace with IrValidator validator when upstream is compatible with PluginContext
class IrValidator(val irBuiltIns: IrBuiltIns, val config: IrValidatorConfig) :
    IrElementVisitorVoid {

    var currentFile: IrFile? = null

    override fun visitFile(declaration: IrFile) {
        currentFile = declaration
        super.visitFile(declaration)

Response:
if (config.checkScopes) {
            ScopeValidator(this::error).check(declaration)
        }
    }

    private fun error(element: IrElement, message: String) {
        throw Error(
            "Validation error ($message) for ${element.dumpSrc()}...  ${element.render()} in" +
                " ${currentFile?.name ?: "???"}"<|endoftext|>


Prompt:
var IdeaKotlinBinaryDependency.isCommonized by isCommonizedKey.readWriteProperty.notNull(false)

/**
 * @see isOpaqueFileDependencyKey
 */
val isOpaqueFileDependencyKey = extrasKeyOf<Boolean>("isOpaqueFileDependencyKey")

/**

Response:
* Marks a dependency as 'opaque' (meaning that we cannot really know about the actual binary coordiantes)
 *
 * Example: File dependencies are 'opaque'
 * ```kotlin
 *    kotlin {
 *        sourceSets.jvmMain.dependencies {
 *            implementation(files("libs/foo.jar")) // <- OPAQUE<|endoftext|>


Prompt:
writeCollection(x.arguments) { writeExpression(it) }
            }

            override fun visitYield(x: JsYield) {
                writeByte(ExpressionIds.YIELD)
                ifNotNull(x.expression) { writeExpression(it) }
            }
        }

        withComments(expression) {
            withLocation(expression) {

Response:
expression.accept(visitor)
            }
        }

        writeBoolean(expression.synthetic)
        writeByte(expression.sideEffects.ordinal)
        ifNotNull(expression.localAlias) { writeImportedModule(it) }
    }

    private fun DataWriter.writeImportedModule(module: JsImportedModule) {
        writeInt(internalizeString(module.externalName))<|endoftext|>


Prompt:
fun <T>case_17(x: T?, f: Boolean) {
    while (f) {
        if (x === implicitNullableNothingProperty || false) { break }
        <!DEBUG_INFO_EXPRESSION_TYPE("T? & T?!!")!>x<!>
        <!DEBUG_INFO_EXPRESSION_TYPE("T? & T?!!")!>x<!>.equals(null)

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


Prompt:
package org.jetbrains.kotlin.fir.builder

import org.jetbrains.kotlin.psi.KtFile

abstract class AbstractRawFirBuilderLazyBodiesByAstTest : AbstractRawFirBuilderLazyBodiesTestCase() {
    override fun createKtFile(filePath: String): KtFile {

Response:
val file = super.createKtFile(filePath)
        file.calcTreeElement()
        assertNotNull("Ast tree for the file must be not null", file.treeElement)
        return file
    }
}<|endoftext|>


Prompt:
<!CONFLICTING_OVERLOADS!>constructor(arg: Invariant<T>)<!>
    }

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

    class TestIdenticalPrivateVisibility {<|endoftext|>


Prompt:
@file:Suppress("FunctionName")

package org.jetbrains.kotlin.gradle.regressionTests

import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.file.FileCollection
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation

Response:
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
import org.jetbrains.kotlin.gradle.util.assertNoCircularTaskDependencies
import org.jetbrains.kotlin.gradle.util.buildProjectWithMPP
import org.jetbrains.kotlin.gradle.util.kotlin
import kotlin.test.Test<|endoftext|>


Prompt:
// !LANGUAGE: +AllowAssigningArrayElementsToVarargsInNamedFormForFunctions
// ISSUE: KT-63514
// WITH_STDLIB

fun foo(vararg arr: Int): Int {
    return arr.sum()
}

fun bar(vararg arr: UInt): UInt {
    return arr.sum()
}

Response:
fun baz(vararg arr: ULong): ULong {
    return arr.sum()
}

fun quas(vararg arr: UShort): UInt {
    return arr.sum()
}

fun wex(vararg arr: UByte): UInt {
    return arr.sum()
}

fun box(): String {<|endoftext|>


Prompt:
fun minBySelectorEvaluateOnce() {
        val source = listOf("a", "bcd", "e")
        var c = 0
        source.minBy { c++ }
        assertEquals(3, c)
        c = 0
        source.minByOrNull { c++ }
        assertEquals(3, c)
    }

    @Test

Response:
fun maxBySelectorEvaluateOnce() {
        val source = listOf("a", "bcd", "e")
        var c = 0
        source.maxBy { c++ }
        assertEquals(3, c)
        c = 0
        source.maxByOrNull { c++ }
        assertEquals(3, c)
    }<|endoftext|>


Prompt:
val params: MutableMap<String, String?> = mutableMapOf("required" to null)
        assertFailsWith<IllegalArgumentException> { printRequiredParam(params) }
        assertFailsWith<IllegalArgumentException> { printRequiredParamByUpperCase(params) }

        params["required"] = "non-empty-param"

Response:
printRequiredParam(params) // prints "non-empty-param"
        printRequiredParamByUpperCase(params) // prints "NON-EMPTY-PARAM"
    }

    @Sample
    fun failCheckWithLazyMessage() {

        var someState: String? = null
        fun getStateValue(): String {<|endoftext|>


Prompt:
if (spilledVariables != setOf("label" to "4", "I$0" to "1", "L$0" to "null", "L$1" to "null")) return "FAIL 8: $spilledVariables"
    c?.resume(Unit)

Response:
if (spilledVariables != setOf("label" to "4", "I$0" to "1", "L$0" to "null", "L$1" to "null")) return "FAIL 9: $spilledVariables"

    return "OK"
}<|endoftext|>


Prompt:
// parameter is NOT suspend
// Block is allowed to be called inside the body of owner inline function
// Block is allowed to be called from nested classes/lambdas (as common crossinlines)
// It is NOT possible to call startCoroutine on the parameter
// suspend calls NOT possible inside lambda matching to the parameter

inline fun test(crossinline c: () -> Unit) {
    c()
    val o = object: Runnable {

Response:
override fun run() {
            c()
        }
    }
    val l = { c() }
    <!USAGE_IS_NOT_INLINABLE!>c<!>.startCoroutine(EmptyContinuation)
}

suspend fun calculate() = "OK"

fun box() {
    test {<|endoftext|>


Prompt:
val statements = rootBlock.getStatements()

        statements.add(0, JsStringLiteral("use strict").makeStmt())
        if (!isBuiltinModule(fragments)) {
            defineModule(program, statements, moduleId)
        }

        // Invoke function passing modules as arguments
        // This should help minifier tool to recognize references to these modules as local variables and make them shorter.

Response:
for (importedModule in importedModules) {
            rootFunction.parameters.add(JsParameter(importedModule.internalName))
        }

        statements.add(JsReturn(internalModuleName.makeRef()))

        val block = program.globalBlock
        block.statements.addAll(
            ModuleWrapperTranslation.wrapIfNecessary(<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.analysis.js.checkers.isEffectivelyExternal
import org.jetbrains.kotlin.fir.analysis.js.checkers.isOverridingExternalWithOptionalParams
import org.jetbrains.kotlin.fir.declarations.FirClass
import org.jetbrains.kotlin.fir.declarations.FirDeclaration

Response:
import org.jetbrains.kotlin.fir.declarations.FirFunction
import org.jetbrains.kotlin.fir.declarations.utils.isExpect

sealed class FirJsInheritanceFunctionChecker(mppKind: MppCheckerKind) : FirFunctionChecker(mppKind) {<|endoftext|>


Prompt:
package org.jetbrains.kotlin.load.java

import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.FqNameUnsafe

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

object BuiltinSpecialProperties {
    val PROPERTY_FQ_NAME_TO_JVM_GETTER_NAME_MAP: Map<FqName, Name> = mapOf(
        StandardNames.FqNames._enum.childSafe("name") to StandardNames.NAME,<|endoftext|>


Prompt:
generateSerializerForType(type, this, intrinsicType)
                        }
                        signature.append(kSerializerArrayType.descriptor)
                    }
                }

                referenceArraySerializerId -> {
                    // a special way to instantiate reference array serializer -- need an element KClass reference

Response:
aconst(typeMapper.mapTypeCommon(typeArgumentsAsTypes.first(), TypeMappingMode.GENERIC_ARGUMENT))
                    AsmUtil.wrapJavaClassIntoKClass(this)
                    signature.append(AsmTypes.K_CLASS_TYPE.descriptor)
                    // Reference array serializer still needs serializer for its argument type<|endoftext|>


Prompt:
namedFunctions[name] = Pair(FunctionWithWrapper(x, null), x)
            }
            super.visitFunction(x)
        }
    })

    return namedFunctions
}

data class FunctionWithWrapper(val function: JsFunction, val wrapperBody: JsBlock?)

fun collectAccessors(scope: JsNode): Map<String, FunctionWithWrapper> {

Response:
val accessors = hashMapOf<String, FunctionWithWrapper>()

    scope.accept(object : RecursiveJsVisitor() {
        override fun visitInvocation(invocation: JsInvocation) {
            InlineMetadata.decompose(invocation)?.let {
                accessors[it.tag.value] = it.function
            }
            super.visitInvocation(invocation)<|endoftext|>


Prompt:
* MAIN LINK: overload-resolution, receivers -> paragraph 5 -> sentence 5
 * PRIMARY LINKS: overload-resolution, receivers -> paragraph 5 -> sentence 4
 * overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 2
 * NUMBER: 1
 * DESCRIPTION: Superclass companion object receivers are prioritized according to the inheritance order
 */

Response:
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package testsCase1

open class A {
    operator fun invoke() = print("invoke")
}

interface Super_0 {
    companion object values : A()

    private fun case() {<|endoftext|>


Prompt:
}
}
})()"""
)
private external fun externrefHashCode(ref: ExternalInterfaceType): Int

private fun externrefToString(ref: ExternalInterfaceType): String =
    js("String(ref)")

private fun externrefToUByte(ref: ExternalInterfaceType): UByte =
    js("Number(ref)")

Response:
private fun externrefToUShort(ref: ExternalInterfaceType): UShort =
    js("Number(ref)")

private fun externrefToUInt(ref: ExternalInterfaceType): UInt =
    js("Number(ref)")

private fun externrefToULong(ref: ExternalInterfaceType): ULong =
    js("BigInt(ref)")<|endoftext|>


Prompt:
override val suiteFun = getFunctions(FqName("kotlin.test.suite")).singleOrNull()?.let {
        symbolTable.descriptorExtension.referenceSimpleFunction(it)
    }
    override val testFun = getFunctions(FqName("kotlin.test.test")).singleOrNull()?.let {

Response:
symbolTable.descriptorExtension.referenceSimpleFunction(it)
    }

    val throwableConstructors by lazy2 { throwableClass.owner.declarations.filterIsInstance<IrConstructor>().map { it.symbol } }
    val defaultThrowableCtor by lazy2 { throwableConstructors.single { !it.owner.isPrimary && it.owner.valueParameters.size == 0 } }<|endoftext|>


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

import org.gradle.api.NamedDomainObjectFactory
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.attributes.Category
import org.gradle.api.attributes.Usage

Response:
import org.jetbrains.kotlin.gradle.dsl.metadataTarget
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtensionOrNull
import org.jetbrains.kotlin.gradle.plugin.*
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages<|endoftext|>


Prompt:
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
import org.jetbrains.kotlin.ir.backend.js.lower.PropertyLazyInitLowering
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrVariable

Response:
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.util.fileOrNull
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
import org.jetbrains.kotlin.ir.visitors.acceptVoid<|endoftext|>


Prompt:
fun testRenamedPackage() = withRootDir(File("$TEST_SUITE_PATH/renameFileOrPackage")) {
        val lib = compileLibrary("lib") { "lib/lib.kt" copyTo "lib.kt" }
        val main = compileToExecutable("main", lib) { "main/main.kt" copyTo "main.kt" }

Response:
// Check, <lib> has been compiled to cache.
        assertTrue(main.executableFile.exists())
        val libKtCacheDir = getLibraryFileCache("lib", "lib/lib.kt", "test")
        assertTrue(libKtCacheDir.exists())
        runExecutableAndVerify(main.testCase, main.testExecutable)<|endoftext|>


Prompt:
private val any = components.session.builtinTypes.anyType.type
    private val nullableNothing = components.session.builtinTypes.nullableNothingType.type

    // ----------------------------------- Requests -----------------------------------

    /**
     * When variable access resolution encounters a variable access which has smartcast information, assignments associated with that
     * variable are checked to determine variable stability, and therefore smartcast stability. These assignments are tracked by

Response:
* [FirLocalVariableAssignmentAnalyzer], which knows how each assignment may limit variable stability, like assignments within or after
     * a non-in-place lambda body. So for a given lexical scope (function body, lambda body, and even local class init) and a given
     * variable, [FirLocalVariableAssignmentAnalyzer] knows all associated assignments (past and/or future) which could limit stability.
     *<|endoftext|>


Prompt:
// test.kt:-1 create
// test.kt:15 empty
// test.kt:21 invokeSuspend
// test.kt:22 invokeSuspend
// Continuation.kt:... resumeWith
// test.kt:11 resumeWith
// test.kt:12 resumeWith
// Continuation.kt:... resumeWith
// test.kt:13 builder
// test.kt:23 invokeSuspend

Response:
// Continuation.kt:... resumeWith
// test.kt:11 resumeWith
// test.kt:12 resumeWith
// Continuation.kt:... resumeWith
// test.kt:13 builder
// test.kt:24 box

// EXPECTATIONS WASM<|endoftext|>


Prompt:
class ConeTypeRendererForDebugging() : ConeTypeRenderer() {

    constructor(builder: StringBuilder) : this() {
        this.builder = builder
        this.idRenderer = ConeIdRendererForDebugging()
        idRenderer.builder = builder
    }

    override fun renderAsPossibleFunctionType(
        type: ConeKotlinType,

Response:
functionClassKindExtractor: (ConeKotlinType) -> FunctionTypeKind?,
        renderType: ConeTypeProjection.() -> Unit
    ) {
        builder.append("R|")
        super.renderAsPossibleFunctionType(type, functionClassKindExtractor, renderType)
        builder.append("|")
    }
}<|endoftext|>


Prompt:
ifNotNull(case as? JsCase) {
                            writeExpression(it.caseExpression)
                        }
                    }
                    writeCollection(case.statements) { part ->
                        writeStatement(part)
                    }
                }
            }

            override fun visitWhile(x: JsWhile) {
                writeByte(StatementIds.WHILE)
                writeExpression(x.condition)

Response:
writeStatement(x.body)
            }

            override fun visitDoWhile(x: JsDoWhile) {
                writeByte(StatementIds.DO_WHILE)
                writeExpression(x.condition)
                writeStatement(x.body)
            }

            override fun visitFor(x: JsFor) {
                writeByte(StatementIds.FOR)<|endoftext|>


Prompt:
private fun deserializeMultiFieldValueClassRepresentation(proto: ProtoIrMultiFieldValueClassRepresentation): MultiFieldValueClassRepresentation<IrSimpleType> {
        val names = proto.underlyingPropertyNameList.memoryOptimizedMap { deserializeName(it) }
        val types = proto.underlyingPropertyTypeList.memoryOptimizedMap { deserializeIrType(it) as IrSimpleType }

Response:
return MultiFieldValueClassRepresentation(names memoryOptimizedZip types)
    }

    private fun computeMissingInlineClassRepresentationForCompatibility(irClass: IrClass): InlineClassRepresentation<IrSimpleType> {
        // For inline classes compiled with 1.5.20 or earlier, try to reconstruct inline class representation from the single parameter of<|endoftext|>


Prompt:
private val settings: AbiRenderingSettings,
    private val output: Appendable
) {
    fun render() {
        printHeader()

        if (settings.renderDeclarations)
            printTopLevelDeclarations(libraryAbi.topLevelDeclarations, Printer(output, settings))
    }

    private fun printHeader() {
        output.appendLine(
            """
                // Rendering settings:

Response:
// - Signature version: ${settings.renderedSignatureVersion.versionNumber}
                // - Show manifest properties: ${settings.renderManifest}
                // - Show declarations: ${settings.renderDeclarations}

                // Library unique name: <${libraryAbi.uniqueName}>
            """.trimIndent()
        )

        if (settings.renderManifest) {<|endoftext|>


Prompt:
testServices.assertions.assertEquals(expectedLines, actualLines) { generatedCode }
    }
}

fun createIrJsLineNumberHandler(testServices: TestServices): JsBinaryArtifactHandler {
    return JsLineNumberHandler(FrontendKinds.ClassicFrontend, testServices)
}

Response:
fun createFirJsLineNumberHandler(testServices: TestServices): JsBinaryArtifactHandler {
    return JsLineNumberHandler(FrontendKinds.FIR, testServices)
}<|endoftext|>


Prompt:
assertEquals(listOf(1, 2, 3, 4, 5), intList)

    val longList = mutableListOf<Long>()
    for (i in 1L until 7L step 2L step 1L) {
        longList += i
    }
    assertEquals(listOf(1L, 2L, 3L, 4L, 5L), longList)

Response:
val charList = mutableListOf<Char>()
    for (i in 'a' until 'g' step 2 step 1) {
        charList += i
    }
    assertEquals(listOf('a', 'b', 'c', 'd', 'e'), charList)

    return "OK"
}<|endoftext|>


Prompt:
builder.append(args.joinToString(", "))
        builder.append(");\n")

        if (!isVoidReturned) {
            val result = translateArgument(
                    "result", cfunction[0], Direction.KOTLIN_TO_C, builder)
            builder.append("  return $result;\n")
        }
        builder.append("   } catch (...) {")

Response:
builder.append("       SetCurrentFrame(reinterpret_cast<KObjHeader**>(frame));\n")
        builder.append("       HandleCurrentExceptionWhenLeavingKotlinCode();\n")
        builder.append("   } \n")

        builder.append("}\n")

        return builder.toString()
    }<|endoftext|>


Prompt:
JAVAX_PARAMETERS_ARE_NULLABLE_BY_DEFAULT_ANNOTATION_FQ_NAME to
            JavaDefaultQualifiers(
                NullabilityQualifierWithMigrationStatus(NullabilityQualifier.NULLABLE),
                APPLICABILITY_OF_JAVAX_DEFAULTS
            ),
)

Response: val BUILT_IN_TYPE_QUALIFIER_DEFAULT_ANNOTATIONS = JSPECIFY_DEFAULT_ANNOTATIONS + JAVAX_DEFAULT_ANNOTATIONS<|endoftext|>


Prompt:
endOffset: Int,
    origin: IrDeclarationOrigin,
    private val firAccessor: FirPropertyAccessor?,
    private val isSetter: Boolean,
    private val firParentProperty: FirProperty,
    firParentClass: FirRegularClass?,
    symbol: IrSimpleFunctionSymbol,
    parent: IrDeclarationParent,
    isFakeOverride: Boolean,

Response:
override var correspondingPropertySymbol: IrPropertySymbol?
) : AbstractFir2IrLazyFunction<FirCallableDeclaration>(c, startOffset, endOffset, origin, symbol, parent, isFakeOverride) {
    init {
        symbol.bind(this)
    }

    override val fir: FirCallableDeclaration
        get() = firAccessor ?: firParentProperty<|endoftext|>


Prompt:
import org.jetbrains.kotlin.resolve.constants.*
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
import org.jetbrains.kotlin.resolve.isInlineClassType

Response:
import org.jetbrains.kotlin.resolve.needsMfvcFlattening
import org.jetbrains.kotlin.serialization.deserialization.DeserializationContext
import org.jetbrains.kotlin.serialization.deserialization.MemberDeserializer
import java.lang.reflect.Field
import java.lang.reflect.Method
import java.lang.reflect.Type<|endoftext|>


Prompt:
override fun visitThrow(expression: IrThrow) {
            thrownValues += expression.value
            super.visitThrow(expression)
        }

        override fun visitCatch(aCatch: IrCatch) {
            catchParameters.add(aCatch.catchParameter)
            super.visitCatch(aCatch)
        }

Response:
override fun visitSetValue(expression: IrSetValue) {
            super.visitSetValue(expression)
            assignValue(expression.symbol.owner, expression.value)
        }

        override fun visitVariable(declaration: IrVariable) {
            variableValues.addEmpty(declaration, currentLoop)
            super.visitVariable(declaration)<|endoftext|>


Prompt:
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoots

Response:
import org.jetbrains.kotlin.cli.jvm.config.configureJdkClasspathRoots
import org.jetbrains.kotlin.cli.jvm.config.jvmClasspathRoots
import org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar<|endoftext|>


Prompt:
): IrExpression {
        // The rule for SAM conversions is: the argument must be a subtype of the required function type.
        // We handle intersection types, captured types, etc. by approximating both expected and actual types.
        var approximatedConeKotlinFunctionType = getFunctionTypeForPossibleSamType(samType)?.approximateForIrOrSelf(c) ?: return argument

Response:
// This line is not present in the K1 counterpart because there is InsertImplicitCasts::cast that effectively removes
        // such unnecessary casts. At the same time, many IR lowerings assume that there are no such redundant casts and many
        // tests from FirBlackBoxCodegenTestGenerated relevant to INDY start failing once this line is removed.<|endoftext|>


Prompt: if (<!SENSELESS_COMPARISON!>x !== null == null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit?")!>x<!>.propNullableT

Response: if (<!SENSELESS_COMPARISON!>x !== null == null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit?")!>x<!>.propNullableAny<|endoftext|>


Prompt:
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
 * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
 */
@SinceKotlin("1.4")
public fun DoubleArray.reverse(fromIndex: Int, toIndex: Int): Unit {

Response:
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
    val midPoint = (fromIndex + toIndex) / 2
    if (fromIndex == midPoint) return
    var reverseIndex = toIndex - 1
    for (index in fromIndex until midPoint) {
        val tmp = this[index]
        this[index] = this[reverseIndex]
        this[reverseIndex] = tmp<|endoftext|>


Prompt:
package org.jetbrains.kotlin.backend.common

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.util.SourceCodeAnalysisException

Response:
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.name.Name<|endoftext|>


Prompt:
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) =
        super.report(adjustSeverity(severity, message, location), message, location)

    private fun adjustSeverity(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) =
        when {
            !severity.isWarning -> {

Response:
// Don't adjust severity for non-warnings.
                severity
            }
            location != null -> {
                // Don't adjust severity for any syntax and semantic warnings.
                severity
            }
            isPreReleaseBinariesWarning(message)
                    || isUnsafeCompilerArgumentsWarning(message)
                    || isLibraryIncludedMoreThanOnceWarning(message)
                    || isK2Experimental(message)<|endoftext|>


Prompt:
val returnTargetSymbolType = type(symbols, "IrReturnTargetSymbol")
val functionSymbolType = type(symbols, "IrFunctionSymbol")
val constructorSymbolType = type(symbols, "IrConstructorSymbol")
val simpleFunctionSymbolType = type(symbols, "IrSimpleFunctionSymbol")

Response:
val returnableBlockSymbolType = type(symbols, "IrReturnableBlockSymbol")
val propertySymbolType = type(symbols, "IrPropertySymbol")
val localDelegatedPropertySymbolType = type(symbols, "IrLocalDelegatedPropertySymbol")
val typeAliasSymbolType = type(symbols, "IrTypeAliasSymbol")<|endoftext|>


Prompt:
package org.jetbrains.kotlin.utils

/**
 * Sorts [nodes] topologically collecting direct edges via [dependencies]. [nodes] and [dependencies] must form a directed, acyclic graph.
 * [topologicalSort] will throw an [IllegalStateException] if it encounters a cycle.
 *

Response:
* The algorithm is based on depth-first search, starting in order from each node in [nodes]. Kahn's algorithm is harder to apply to the
 * ad-hoc dependency structure because it's not easily apparent whether a node has no other incoming edges.
 *
 * For example, consider the following structure: `C -> A, C -> B, B -> A`. The resulting order should be `[C, B, A]`. However, `A` is<|endoftext|>


Prompt:
package org.jetbrains.kotlin.lombok.k2.generators

import org.jetbrains.kotlin.KtFakeSourceElementKind
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.fakeElement
import org.jetbrains.kotlin.fir.FirSession

Response:
import org.jetbrains.kotlin.fir.containingClassForStaticMemberAttr
import org.jetbrains.kotlin.fir.declarations.FirFunction
import org.jetbrains.kotlin.fir.declarations.builder.buildConstructedClassTypeParameterRef
import org.jetbrains.kotlin.fir.declarations.builder.buildTypeParameterCopy<|endoftext|>


Prompt:
return <!CONSTANT_EXPECTED_TYPE_MISMATCH!>1.0<!>
    return <!CONSTANT_EXPECTED_TYPE_MISMATCH!>2.0<!>
}
fun blockReturnValueTypeMatch6() : Int {
    if (1 > 2)

Response:
else return <!CONSTANT_EXPECTED_TYPE_MISMATCH!>1.0<!>
    return <!CONSTANT_EXPECTED_TYPE_MISMATCH!>2.0<!>
}
fun blockReturnValueTypeMatch7() : Int {
    if (1 > 2)
    1.0
    else 2.0<|endoftext|>


Prompt:
COMPLETED SKIPPED // jsTest//my/company/product/MyTest/MyTestNested/my.company.product.MyTest.MyTestNested.myTest6
      STARTED SUITE my.company.product.MyTest.MyTestNested.MyTestNestedNested // jsTest//my/company/product/MyTest/MyTestNested/MyTestNestedNested

Response: STARTED TEST displayName: myTest7, classDisplayName: MyTestNestedNested, className: my.company.product.MyTest.MyTestNestedNested, name: myTest7 // jsTest//my/company/product/MyTest/MyTestNested/MyTestNestedNested/my.company.product.MyTest.MyTestNestedNested.myTest7<|endoftext|>


Prompt:
// a redundant jump after the call when generating the machine code, ruining the expected code pattern.
    //
    // To workaround this, we generate the call and the pattern after it as a separate noinline function ("outlined"),
    // and catch the exceptions in the caller of this function.
    // So, no exception handler in "outlined" => no redundant jump => the optimized return works properly.

Response:
val functionIsPassedAsLastParameter = !function.isConstant

    val valuesToPass = args + if (functionIsPassedAsLastParameter) listOf(function.asCallback()) else emptyList()
    val outlinedType = LlvmFunctionSignature(
            signature.returnType,<|endoftext|>


Prompt:
if (declaration !is KtClassOrObject) {
            diagnosticHolder.report(ErrorsParcelize.PARCELABLE_SHOULD_BE_CLASS.on(declaration))
            return
        }

        if (declaration is KtClass && (declaration.isAnnotation() || declaration.isInterface() && !declaration.isSealed())) {

Response:
val reportElement = declaration.nameIdentifier ?: declaration
            diagnosticHolder.report(ErrorsParcelize.PARCELABLE_SHOULD_BE_CLASS.on(reportElement))
            return
        }

        for (companion in declaration.companionObjects) {
            if (companion.name == "CREATOR") {
                val reportElement = companion.nameIdentifier ?: companion<|endoftext|>


Prompt:
import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeUtils

Response:
import org.jetbrains.kotlin.types.UnwrappedType
import org.jetbrains.kotlin.types.expressions.OperatorConventions
import org.jetbrains.kotlin.types.typeUtil.contains
import org.jetbrains.kotlin.util.OperatorNameConventions
import org.jetbrains.kotlin.utils.addToStdlib.safeAs<|endoftext|>


Prompt:
*                           |
     *                      +----+----+
     *                      |         |
     *                iosX64Main   iosArm64Main
     */
    @Test
    fun `test - diamond hierarchy from documentation example`() {
        kotlin.applyHierarchyTemplate {
            common {
                group("ios") {
                    withIos()
                }
                group("frontend") {

Response:
withJvm()
                    group("ios") // <- ! We can again reference the 'ios' group
                }
                group("apple") {
                    withMacos()
                    group("ios") // <- ! We can again reference the 'ios' group
                }
            }
        }

        kotlin.iosX64()
        kotlin.iosArm64()
        kotlin.macosX64()<|endoftext|>


Prompt:
.setPrettyPrinting()
            .disableHtmlEscaping()
            .serializeNulls()
            .registerTypeAdapterFactory(PackageJsonTypeAdapter())
            .create()

        packageJsonFile.ensureParentDirsCreated()
        val jsonTree = gson.toJsonTree(this)
        val previous = if (packageJsonFile.exists()) {

Response:
packageJsonFile.reader().use {
                JsonParser.parseReader(it)
            }
        } else null

        if (jsonTree != previous) {
            packageJsonFile.writer().use {
                gson.toJson(jsonTree, it)
            }
        }
    }
}

fun fromSrcPackageJson(packageJson: File?): PackageJson? =<|endoftext|>


Prompt:
assertMaturity(DEV, "1.8.0-one-two-three-2022")
        assertMaturity(DEV, "1.8.0-one-a1-b2-2022")
        assertMaturity(DEV, "1.8.0-temporary-999")

Response:
assertMaturity(DEV, "1.8.0-snapshot-42", "Looks strange but snapshot is rather special to allow more usages")
        assertMaturity(DEV, "1.8.0-dev-")
        assertMaturity(DEV, "1.8.0-t-1000")
        assertMaturity(DEV, "1.8.0-no-1")<|endoftext|>


Prompt:
package org.jetbrains.kotlin.konan.test.blackbox

import com.intellij.openapi.util.text.StringUtilRt
import com.intellij.testFramework.TestDataFile
import org.jetbrains.kotlin.konan.target.Family
import org.jetbrains.kotlin.konan.target.KonanTarget

Response:
import org.jetbrains.kotlin.konan.test.blackbox.support.TestCInteropArgs
import org.jetbrains.kotlin.konan.test.blackbox.support.TestCompilerArgs
import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.TestCompilationResult<|endoftext|>


Prompt:
private fun convertReceiverType(receiverType: LighterASTNode): FirTypeRef {
        receiverType.forEachChildren {
            when (it.tokenType) {
                TYPE_REFERENCE -> return convertType(it)
            }
        }

        //TODO specify error
        throw Exception()
    }

    /**

Response:
* @see org.jetbrains.kotlin.parsing.KotlinParsing.parseNullableTypeSuffix
     */
    private fun convertNullableType(
        typeRefSource: KtSourceElement,
        nullableType: LighterASTNode,
        allTypeModifiers: MutableList<Modifier>,
        isNullable: Boolean = true
    ): FirTypeRef {<|endoftext|>


Prompt:
val TEXTURE_2D: Int
        val TEXTURE: Int
        val TEXTURE_CUBE_MAP: Int
        val TEXTURE_BINDING_CUBE_MAP: Int
        val TEXTURE_CUBE_MAP_POSITIVE_X: Int
        val TEXTURE_CUBE_MAP_NEGATIVE_X: Int

Response:
val TEXTURE_CUBE_MAP_POSITIVE_Y: Int
        val TEXTURE_CUBE_MAP_NEGATIVE_Y: Int
        val TEXTURE_CUBE_MAP_POSITIVE_Z: Int
        val TEXTURE_CUBE_MAP_NEGATIVE_Z: Int
        val MAX_CUBE_MAP_TEXTURE_SIZE: Int
        val TEXTURE0: Int<|endoftext|>


Prompt:
arg25: Long = 0L, arg26: Long = 0L, arg27: Long = 0L, arg28: Long = 0L, arg29: Long = 0L,
    arg30: Long = 0L, arg31: Long = 0L, x: A = A(0)
) = "OK"

fun test64(

Response:
arg00: Long = 0L, arg01: Long = 0L, arg02: Long = 0L, arg03: Long = 0L, arg04: Long = 0L,
    arg05: Long = 0L, arg06: Long = 0L, arg07: Long = 0L, arg08: Long = 0L, arg09: Long = 0L,<|endoftext|>


Prompt:
f.remove(null)

    i.size
    i.remove(null)
    i.remove(true)
    i.remove("")

    j.size
    j.remove(null)
    j.remove(true)
    j.remove("")

    k.size
    k.remove(null)
    k.remove(true)
    k.remove("")

Response:
l.size
    l.remove(null)
    l.remove(true)
    l.remove("")

    m.size
    m.remove(null)
    m.remove(true)
    m.remove("")

    n.size
    n.remove(null)
    n.remove(true)
    n.remove("")
}<|endoftext|>


Prompt:
* Note that some types have platform-specific counterparts, i.e. kotlin.String is mapped to java.lang.String,
     * such types (and all their sub- and supertypes) are related too.
     *
     * Due to limitations in PlatformToKotlinClassMap, we only consider mapping of platform classes to Kotlin classed

Response:
* (i.e. java.lang.String -> kotlin.String) and ignore mappings that go the other way.
     */
    private fun isRelated(a: KotlinType, b: KotlinType, platformToKotlinClassMapper: PlatformToKotlinClassMapper): Boolean {
        val aClasses = mapToPlatformIndependentClasses(a, platformToKotlinClassMapper)<|endoftext|>


Prompt:
import org.junit.jupiter.api.io.TempDir
import java.nio.file.Path
import kotlin.io.path.appendText
import kotlin.io.path.readText
import kotlin.test.assertEquals

@MppGradlePluginTests
@DisplayName("Multiplatform metadata for tooling")

Response:
class KotlinToolingMetadataMppIT : KGPBaseTest() {
    private val TestProject.defaultKotlinToolingMetadataJsonPath
        get() = projectPath.resolve("build/kotlinToolingMetadata/kotlin-tooling-metadata.json")

    private val buildKotlinToolingMetadataTaskName<|endoftext|>


Prompt:
defaultValue: TResult? = null,
        required: Boolean = false,
        val multiple: Boolean = false,
        val delimiter: String? = null,
        deprecatedWarning: String? = null) : Descriptor<T, TResult>(type, fullName, description, defaultValue,
        required, deprecatedWarning) {

    override val textDescription: String

Response:
get() = "option $optionFullFormPrefix$fullName"

    override val helpMessage: String
        get() {
            val result = StringBuilder()
            result.append("    $optionFullFormPrefix$fullName")
            shortName?.let { result.append(", $optionShortFromPrefix$it") }
            valueDescription(defaultValue)?.let {
                result.append(it)<|endoftext|>


Prompt:
fun isEqual(l: Any?, r: Any?) = if (l == r) true else null

fun box(stepId: Int): String {
    when (stepId) {
        0, 8, 15, 16 -> isEqual(foo(), 42) ?: return "Fail"
        1 -> isEqual(foo(), false) ?: return "Fail"

Response:
2 -> isEqual(foo(), 3.14) ?: return "Fail"
        3, 5, 6, 12 -> isEqual(foo(), "string") ?: return "Fail"
        4 -> isEqual(foo(), null) ?: return "Fail"
        7 -> {
            foo() // Unit
            return "OK"
        }<|endoftext|>