Prompt:
11.0.calcDouble(fun (a: Int, b: Double) = a + b)
    }
    return inlineX.doWorkWithDouble(11.0)
}

fun box(): String {
    if (test1() != 25) return "test1: ${test1()}"
    if (test2() != 25) return "test2: ${test2()}"

Response:
if (test3() != 20) return "test3: ${test3()}"
    if (test4() != 20.0) return "test4: ${test4()}"
    if (test5() != 20.0) return "test5: ${test5()}"

    return "OK"
}<|endoftext|>


Prompt:
import org.jetbrains.kotlin.test.directives.JsEnvironmentConfigurationDirectives.GENERATE_INLINE_ANONYMOUS_FUNCTIONS
import org.jetbrains.kotlin.test.directives.JsEnvironmentConfigurationDirectives.MODULE_KIND
import org.jetbrains.kotlin.test.directives.JsEnvironmentConfigurationDirectives.NO_INLINE


Prompt:
// TARGET_BACKEND: JVM
// WITH_STDLIB
// FULL_JDK
// SKIP_JDK6

import java.lang.annotation.Documented

annotation class NoDocumented

@MustBeDocumented
annotation class ExplicitMustBeDocumented

@Documented
annotation class ExplicitJavaDocumented

@MustBeDocumented
@Documented
annotation class ExplicitBoth

Response:
inline fun <reified A> isDocumented(): Boolean =
    A::class.java.getDeclaredAnnotation(Documented::class.java) != null

fun box(): String {
    if (isDocumented<NoDocumented>()) return "Fail NoDocumented"
    if (!isDocumented<ExplicitMustBeDocumented>()) return "Fail ExplicitMustBeDocumented"<|endoftext|>


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

// TODO: consider combining with DeprecatedCallChecker somehow
object ApiVersionCallChecker : CallChecker {
    override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {

Response:
check(resolvedCall.resultingDescriptor, context, reportOn)
    }

    private fun check(targetDescriptor: CallableDescriptor, context: CallCheckerContext, element: PsiElement) {
        // Objects will be checked by ApiVersionClassifierUsageChecker
        if (targetDescriptor is FakeCallableDescriptorForObject) return<|endoftext|>


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

// FILE: Function.java

public interface Function<Param, Result> {
    Result fun(Param param);
}

// FILE: AdapterProcessor.java

public class AdapterProcessor<T, S> {
    public AdapterProcessor(Function<? super T, ? extends S> conversion) {}
}

Response:
// FILE: main.kt

interface PsiMethod {
    val containingClass: PsiClass?
}

interface PsiClass

fun test() {
    val processor = AdapterProcessor<PsiMethod, PsiClass>(
        Function { method: PsiMethod? -> method?.containingClass }
    )
}<|endoftext|>


Prompt:
File(srcDir, "Foo$i.kt").writeText(code)
            }
        }

        generateFiles()
        initProject(JVM_MOCK_RUNTIME)

        var checkCancelledCalledCount = 0
        val countingCancelledStatus = CanceledStatus {
            checkCancelledCalledCount++
            false
        }

Response:
val logger = TestProjectBuilderLogger()
        val buildResult = BuildResult()

        buildCustom(countingCancelledStatus, logger, buildResult)

        buildResult.assertSuccessful()
        assert(checkCancelledCalledCount > classCount) {
            "isCancelled should be called at least once per class. Expected $classCount, but got $checkCancelledCalledCount"
        }<|endoftext|>


Prompt:
module.serializer<Container.NestedEnum>().checkSerialName("Container.NestedEnum")?.let { return it }
    module.serializer<EnumWithCustom>().checkSerialName("custom|EnumWithCustom")?.let { return it }

Response:
module.serializer<Container.NestedEnumWithCustom>().checkSerialName("custom|Container.NestedEnumWithCustom")?.let { return it }
    module.serializer<EnumWithCustomCl>().checkSerialName("custom|EnumWithCustomCl")?.let { return it }<|endoftext|>


Prompt:
isLVReference = (kind == CXType_LValueReference),
                        spelling = type.name
                )
            }

            CXType_ConstantArray -> {
                val elementType = convertType(clang_getArrayElementType(type))
                val length = clang_getArraySize(type)
                ConstArrayType(elementType, length)
            }

Response:
CXType_IncompleteArray -> {
                val elementType = convertType(clang_getArrayElementType(type))
                IncompleteArrayType(elementType)
            }

            CXType_VariableArray -> {
                val elementType = convertType(clang_getArrayElementType(type))
                VariableArrayType(elementType)
            }

            CXType_FunctionProto -> {<|endoftext|>


Prompt:
class E : D() {
    <!REDUNDANT_VISIBILITY_MODIFIER!>protected<!> override fun willRemainProtected() {
    }

    public override fun willBecomePublic() {
    }
}

enum class F <!REDUNDANT_VISIBILITY_MODIFIER!>private<!> constructor(val x: Int) {
    FIRST(42)
}

Response:
sealed class G constructor(val y: Int) {
    <!REDUNDANT_VISIBILITY_MODIFIER!>private<!> constructor(): this(42)

    object H : G()
}

interface I {
    fun bar()
}

<!REDUNDANT_VISIBILITY_MODIFIER!>public<!> var baz = 0

open class J {<|endoftext|>


Prompt:
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.internal.InlineOnly
public inline fun LongArray.maxOf(selector: (Long) -> Float): Float {
    if (isEmpty()) throw NoSuchElementException()
    var maxValue = selector(this[0])

Response:
for (i in 1..lastIndex) {
        val v = selector(this[i])
        maxValue = maxOf(maxValue, v)
    }
    return maxValue
}

/**
 * Returns the largest value among all values produced by [selector] function
 * applied to each element in the array.
 *<|endoftext|>


Prompt:
val c = loader.loadClass(if (v) "nonLocalReturn.ShouldBeEnabled" else "nonLocalReturn.ShouldBeDisabled")
    return c.newInstance() as Checker
}

fun box(): String {
    var c = setDesiredAssertionStatus(false)
    if (c.checkTrueWithMessage()) return "FAIL 2"

Response:
if (c.checkFalseWithMessage()) return "FAIL 4"
    c = setDesiredAssertionStatus(true)
    if (!c.checkTrueWithMessage()) return "FAIL 6"
    if (!c.checkFalseWithMessage()) return "FAIL 8"

    return "OK"
}<|endoftext|>


Prompt:
open fun transformResolvedDeclarationStatus(resolvedDeclarationStatus: FirResolvedDeclarationStatus, data: D): FirDeclarationStatus {
        return transformElement(resolvedDeclarationStatus, data)
    }

    final override fun visitResolvedDeclarationStatus(resolvedDeclarationStatus: FirResolvedDeclarationStatus, data: D): FirDeclarationStatus {

Response:
return transformResolvedDeclarationStatus(resolvedDeclarationStatus, data)
    }

    open fun transformControlFlowGraphOwner(controlFlowGraphOwner: FirControlFlowGraphOwner, data: D): FirControlFlowGraphOwner {
        return transformElement(controlFlowGraphOwner, data)
    }<|endoftext|>


Prompt:
return java.util.Arrays.copyOfRange(this, fromIndex, toIndex)
}

@SinceKotlin("1.3")
@PublishedApi
@JvmName("copyOfRange")
internal fun ShortArray.copyOfRangeImpl(fromIndex: Int, toIndex: Int): ShortArray {
    copyOfRangeToIndexCheck(toIndex, size)

Response:
return java.util.Arrays.copyOfRange(this, fromIndex, toIndex)
}

@SinceKotlin("1.3")
@PublishedApi
@JvmName("copyOfRange")
internal fun IntArray.copyOfRangeImpl(fromIndex: Int, toIndex: Int): IntArray {
    copyOfRangeToIndexCheck(toIndex, size)<|endoftext|>


Prompt: expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithRemovedEnumEntryParameterOfParameter() }

Response: expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithRemovedEnumEntryParameterOfParameterInline() }<|endoftext|>


Prompt:
package org.jetbrains.kotlin.fir.java.declarations

import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.fir.FirImplementationDetail
import org.jetbrains.kotlin.fir.FirModuleData
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl

Response:
import org.jetbrains.kotlin.fir.contracts.FirContractDescription
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.builder.FirConstructorBuilder
import org.jetbrains.kotlin.fir.expressions.FirAnnotation<|endoftext|>


Prompt:
val explicitVisibility = element.source?.explicitVisibility
        val isHidden = explicitVisibility.isEffectivelyHiddenBy(containingMemberDeclaration)
        if (isHidden) {
            reportElement(element, context, reporter)
            return
        }

        // In explicit API mode, `public` is explicitly required.

Response:
val explicitApiMode = context.languageVersionSettings.getFlag(AnalysisFlags.explicitApiMode)
        if (explicitApiMode != ExplicitApiMode.DISABLED && explicitVisibility == Visibilities.Public) {
            return
        }

        if (explicitVisibility == implicitVisibility) {
            reportElement(element, context, reporter)
        }
    }<|endoftext|>


Prompt:
// EXPECTED_REACHABLE_NODES: 1319
// MODULE: lib
// FILE: lib.kt

package test

var a = 0

inline var p1: Int
    get() = a + 10000
    set(v) {
        a = v + 100
    }

var p2: Int
    inline get() = a + 20000
    set(v) {

Response:
a = v + 200
    }

var p3: Int
    get() = a + 30000
    inline set(v) {
        a = v + 300
    }

inline var Int.p4: Int
    get() = this * 100 + a + 40000
    set(v) {
        a = this + v + 400
    }

var Int.p5: Int<|endoftext|>


Prompt:
suspend fun run()
}

// Function is NOT suspend
// parameter is noinline
// parameter is suspend
// Block is NOT 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 possible to call startCoroutine on the parameter
// suspend calls possible inside lambda matching to the parameter

Response:
inline fun test(noinline c: suspend () -> Unit)  {
    <!ILLEGAL_SUSPEND_FUNCTION_CALL!>c<!>()
    val o = object : SuspendRunnable {
        override suspend fun run() {
            c()
        }
    }
    val l: suspend () -> Unit = { c() }
    c.startCoroutine(EmptyContinuation)<|endoftext|>


Prompt:
//A lot of blank lines [Don't delete]
    //A lot of blank lines [Don't delete]
    //A lot of blank lines [Don't delete]
    //A lot of blank lines [Don't delete]
    //A lot of blank lines [Don't delete]
    //A lot of blank lines [Don't delete]
    //A lot of blank lines [Don't delete]
    "O" + kValue()

Response:
//A lot of blank lines [Don't delete]
    //A lot of blank lines [Don't delete]
    //A lot of blank lines [Don't delete]
    //A lot of blank lines [Don't delete]
    //A lot of blank lines [Don't delete]
    //A lot of blank lines [Don't delete]
    //A lot of blank lines [Don't delete]<|endoftext|>


Prompt:
// FILE: Test.java
public class Test {
    public static final String FOO = "test";
}

// FILE: test.kt
fun ff() {
    val a = Test.FOO
    val b = <!NO_COMPANION_OBJECT!>Test<!><!UNEXPECTED_SAFE_CALL!>?.<!>FOO
    System.out.println(a + b)

Response:
<!NO_COMPANION_OBJECT!>System<!><!UNEXPECTED_SAFE_CALL!>?.<!>out<!UNSAFE_CALL!>.<!>println(a + b)
}<|endoftext|>


Prompt:
assertEquals("Amsterdam", readOnlyNativeFooWrapperN?.nativeFoo?.s)

    nativeFooNWrapper = NativeFooNWrapper(NativeFoo("Saint-Petersburg"))
    assertEquals("Saint-Petersburg", readOnlyNativeFooNWrapper.nativeFooN?.s)
    nativeFooNWrapper = NativeFooNWrapper(null)

Response:
assertEquals(null, readOnlyNativeFooNWrapper.nativeFooN?.s)

    assertEquals(null, readOnlyNativeFooNWrapperN?.nativeFooN?.s)
    nativeFooNWrapperN = NativeFooNWrapper(NativeFoo("Boston"))<|endoftext|>


Prompt:
@Deprecated("Use Kotlin compiler 1.4 to avoid deprecation warning.")
@SinceKotlin("1.1")
@DeprecatedSinceKotlin(hiddenSince = "1.4")
public fun CharArray.contentHashCode(): Int {
    return this.contentHashCode()
}

/**
 * Returns a hash code based on the contents of this array as if it is [List].
 */

Response:
@SinceKotlin("1.4")
public actual fun <T> Array<out T>?.contentHashCode(): Int {
    if (this === null) return 0
    var result = 1
    for (element in this)
        result = 31 * result + element.hashCode()
    return result
}

/**
 * Returns a hash code based on the contents of this array as if it is [List].
 */<|endoftext|>


Prompt:
}
        }
    }
}

class ES6PrimaryConstructorUsageOptimizationLowering(private val context: JsIrBackendContext) : BodyLoweringPass {
    override fun lower(irBody: IrBody, container: IrDeclaration) {
        irBody.transformChildrenVoid(object : IrElementTransformerVoid() {
            override fun visitCall(expression: IrCall): IrExpression {

Response:
val callee = expression.symbol.owner
                return when {
                    !callee.shouldBeConvertedToPlainConstructor(context) -> super.visitCall(expression)
                    expression.isSyntheticDelegatingReplacement -> {<|endoftext|>


Prompt:
val propertyCache: FirCache<Name, List<FirPropertySymbol>, Nothing?> =
            cachesFactory.createCache { name -> generateMemberProperties(name) }

        val constructorCache: FirLazyValue<List<FirConstructorSymbol>> =
            cachesFactory.createLazyValue { generateConstructors() }

        val allCallableNames: Set<Name>

Response:
get() = extensionsByCallableName.keys

        private val classSymbol: FirClassSymbol<*>
            get() = generationContext.owner

        private fun generateMemberFunctions(name: Name): List<FirNamedFunctionSymbol> {
            if (name == SpecialNames.INIT) return emptyList()
            return extensionsByCallableName[name].orEmpty()<|endoftext|>


Prompt:
ANNOTATION_PROCESSORS_OPTION(
        "processors",
        "<fqname,[fqname2,...]>",
        "Annotation processor qualified names",
        true,
        cliToolOption = CliToolOption("-Kapt-processors", VALUE)
    ),

    APT_OPTION_OPTION(
        "apOption",

Response:
":<key>=<value>",
        "Annotation processor options",
        cliToolOption = CliToolOption("-Kapt-option", KEY_VALUE)
    ),

    JAVAC_OPTION_OPTION(
        "javacOption",
        ":<key>=<value>",
        "Javac options",<|endoftext|>


Prompt:
DiagnosticKind.MissingStdlibClass -> FirErrors.MISSING_STDLIB_CLASS
        DiagnosticKind.IntLiteralOutOfRange -> FirErrors.INT_LITERAL_OUT_OF_RANGE
        DiagnosticKind.FloatLiteralOutOfRange -> FirErrors.FLOAT_LITERAL_OUT_OF_RANGE

Response:
DiagnosticKind.WrongLongSuffix -> FirErrors.WRONG_LONG_SUFFIX
        DiagnosticKind.UnsignedNumbersAreNotPresent -> FirErrors.UNSIGNED_LITERAL_WITHOUT_DECLARATIONS_ON_CLASSPATH
        DiagnosticKind.IncorrectCharacterLiteral -> FirErrors.INCORRECT_CHARACTER_LITERAL<|endoftext|>


Prompt:
if (isLambda) ((function as FirAnonymousFunction).typeRef as? FirResolvedTypeRef)?.type?.isSuspendOrKSuspendFunctionType(session) == true
            else function.isSuspend
        val created = function.convertWithOffsets { startOffset, endOffset ->
            classifierStorage.preCacheTypeParameters(function)
            irFactory.createSimpleFunction(

Response:
startOffset = if (updatedOrigin == IrDeclarationOrigin.DELEGATED_MEMBER) SYNTHETIC_OFFSET else startOffset,
                endOffset = if (updatedOrigin == IrDeclarationOrigin.DELEGATED_MEMBER) SYNTHETIC_OFFSET else endOffset,
                origin = updatedOrigin,
                name = name,<|endoftext|>


Prompt:
// !API_VERSION: 1.0

@SinceKotlin("1.1")
open class Foo

class Bar @SinceKotlin("1.1") constructor()

@SinceKotlin("1.0")
class Baz @SinceKotlin("1.1") constructor()

@SinceKotlin("1.1")
class Quux @SinceKotlin("1.0") constructor()

Response:
fun t1(): <!API_NOT_AVAILABLE!>Foo<!> = <!UNRESOLVED_REFERENCE!>Foo<!>()

// TODO: do not report API_NOT_AVAILABLE twice<|endoftext|>


Prompt:
override val psiTypeProviderImpl: KtPsiTypeProvider = KtFe10PsiTypeProvider(this)
    override val typeProviderImpl: KtTypeProvider = KtFe10TypeProvider(this)
    override val typeInfoProviderImpl: KtTypeInfoProvider = KtFe10TypeInfoProvider(this)

Response:
override val subtypingComponentImpl: KtSubtypingComponent = KtFe10SubtypingComponent(this)
    override val expressionInfoProviderImpl: KtExpressionInfoProvider = KtFe10ExpressionInfoProvider(this)
    override val compileTimeConstantProviderImpl: KtCompileTimeConstantProvider = KtFe10CompileTimeConstantProvider(this)<|endoftext|>


Prompt:
package org.jetbrains.kotlin.resolve.checkers

import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.lexer.KtTokens

Response:
import org.jetbrains.kotlin.psi.KtDeclaration

object SealedInterfaceAllowedChecker : DeclarationChecker {
    override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
        if (descriptor !is ClassDescriptor) return
        if (descriptor.kind != ClassKind.INTERFACE) return<|endoftext|>


Prompt:
val mainClassAndArguments = testServices.jvmBoxMainClassProvider?.getMainClassNameAndAdditionalArguments() ?: run {
            val mainFile = module.files.firstOrNull {
                it.name == MainFunctionForBlackBoxTestsSourceProvider.BOX_MAIN_FILE_NAME && it.isAdditional
            } ?: error("No file with main function was generated. Please check TODO source provider")

Response:
val mainFqName = listOfNotNull(
                MainFunctionForBlackBoxTestsSourceProvider.detectPackage(mainFile),
                "${mainFile.nameWithoutExtension}Kt"
            ).joinToString(".")

            listOf(mainFqName)
        }

        val process = launchSeparateJvmProcess(javaExe, module, classPath, mainClassAndArguments)<|endoftext|>


Prompt:
if (element6 !in 1.0..<3.0 != !range0.contains(element6)) throw AssertionError()
    if (!(element6 in 1.0..<3.0) != !range0.contains(element6)) throw AssertionError()

Response:
if (!(element6 !in 1.0..<3.0) != range0.contains(element6)) throw AssertionError()
}

fun testR0xE7() {
    // with possible local optimizations
    if (2.0 in 1.0..<3.0 != range0.contains(2.0)) throw AssertionError()<|endoftext|>


Prompt:
engine.runBackend(backendContext, psiToIrOutput.irModule)
    }

    private fun produceCLibrary(engine: PhaseEngine<PhaseContext>, config: KonanConfig, environment: KotlinCoreEnvironment) {
        val frontendOutput = engine.runFrontend(config, environment) ?: return

Response:
val (psiToIrOutput, cAdapterElements) = engine.runPsiToIr(frontendOutput, isProducingLibrary = false) {
            if (config.cInterfaceGenerationMode == CInterfaceGenerationMode.V1) {
                it.runPhase(BuildCExports, frontendOutput)
            } else {
                null
            }
        }<|endoftext|>


Prompt:
0xc02a058678adc34fUL,     0x7ff8000000000000UL,     0xbfe193ea7aad030bUL,     0x7ff8000000000000UL,
            0xbfd058aefa811452UL,     0x7ff8000000000000UL,     0x7ff8000000000000UL,     0x7ff8000000000000UL,

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


Prompt:
private sealed class ChangeType {
    object OutOfBlock : ChangeType()
    object Invisible : ChangeType()

    class InBlock(val blockOwner: KtAnnotated, val project: Project) : ChangeType() {
        val ktModule: KtModule by lazy(LazyThreadSafetyMode.NONE) {
            ProjectStructureProvider.getModule(project, blockOwner, contextualModule = null)
        }

Response:
override fun equals(other: Any?): Boolean = other === this || other is InBlock && other.blockOwner == blockOwner
        override fun hashCode(): Int = blockOwner.hashCode()
    }
}

/**
 * The purpose of this property as user data is to avoid FIR building in case the [KtAnnotated]
 * doesn't have an associated FIR with body.
 *<|endoftext|>


Prompt:
// TARGET_BACKEND: JVM

// FILE: J.java

import java.util.*;

public class J {

    private static class MyList extends A {}

    public static String foo() {
        MyList myList = new MyList();
        List<Integer> list = (List<Integer>) myList;

        if (!list.remove((Integer) 1)) return "fail 1";

Response:
if (list.remove((int) 1) != 123) return "fail 2";

        if (!myList.remove((Integer) 1)) return "fail 3";
        if (myList.remove((int) 1) != 123) return "fail 4";

        if (myList.removeAt(1) != 123) return "fail 5";
        return "OK";
    }
}

// FILE: test.kt<|endoftext|>


Prompt:
assertEquals(b.lastTrueIndex, -1)
        assertContainsOnly(b, setOf(), 71)

        // Test set and clear operations for ranges.
        // Set false and clear.
        b = BitSet(2)
        assertContainsOnly(b, setOf(), 2)
        b.set(0..70, true)
        assertNotContainsOnly(b, setOf(), 71)

Response:
b.set(0..2, false)
        assertNotContainsOnly(b, setOf(0, 1, 2), 71)
        b.set(63..65, false)
        assertNotContainsOnly(b, setOf(0, 1, 2, 63, 64, 65), 71)
        b.set(68..70, false)<|endoftext|>


Prompt:
private const val SOURCE_SET_CINTEROP_METADATA_NODE_NAME = "sourceSetCInteropMetadataDirectory"
private const val DEPENDS_ON_NODE_NAME = "dependsOn"
private const val MODULE_DEPENDENCY_NODE_NAME = "moduleDependency"
private const val BINARY_LAYOUT_NODE_NAME = "binaryLayout"

Response: private const val HOST_SPECIFIC_NODE_NAME = "hostSpecific"<|endoftext|>


Prompt:
/**
 * Returns a random element from this array.
 *
 * @throws NoSuchElementException if this array is empty.
 */
@SinceKotlin("1.3")
@kotlin.internal.InlineOnly
public inline fun ByteArray.random(): Byte {
    return random(Random)
}

/**
 * Returns a random element from this array.
 *

Response:
* @throws NoSuchElementException if this array is empty.
 */
@SinceKotlin("1.3")
@kotlin.internal.InlineOnly
public inline fun ShortArray.random(): Short {
    return random(Random)
}

/**
 * Returns a random element from this array.
 *
 * @throws NoSuchElementException if this array is empty.
 */<|endoftext|>


Prompt:
enum entry EXPRESSION

    enum entry FILE

    @kotlin.SinceKotlin(version = "1.1")
    enum entry TYPEALIAS
}

@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.ANNOTATION_CLASS})
public final annotation class MustBeDocumented : kotlin.Annotation {
    public constructor MustBeDocumented()
}

Response:
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.ANNOTATION_CLASS})
public final annotation class Repeatable : kotlin.Annotation {
    public constructor Repeatable()
}

@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.ANNOTATION_CLASS})
public final annotation class Retention : kotlin.Annotation {<|endoftext|>


Prompt:
c.components.javaResolverCache.recordField(field, propertyDescriptor)

        return propertyDescriptor
    }

    private fun createPropertyDescriptor(field: JavaField): PropertyDescriptorImpl {
        val isVar = !field.isFinal
        val annotations = c.resolveAnnotations(field)

        return JavaPropertyDescriptor.create(

Response:
ownerDescriptor, annotations, Modality.FINAL, field.visibility.toDescriptorVisibility(), isVar, field.name,
            c.components.sourceElementFactory.source(field), /* isConst = */ field.isFinalStatic
        )
    }

    private val JavaField.isFinalStatic: Boolean
        get() = isFinal && isStatic<|endoftext|>


Prompt:
for ((qualifier, isExpected) in qualifiersToCheck) {
            val actual = modifierList.hasAnnotation(qualifier)
            testServices.assertions.assertEquals(expected = isExpected, actual = actual) {
                "$qualifier isExpected: $isExpected, but $actual is found"
            }

            val psiAnnotation = modifierList.findAnnotation(qualifier)

Response:
if (isExpected) {
                testServices.assertions.assertNotNull(psiAnnotation)
            }

            psiAnnotation?.let(annotationsFromFindAnnotation::add)
        }

        testServices.assertions.assertEquals(expected = expectedAnnotations.size, actual = annotationsFromFindAnnotation.size)
        val annotations = modifierList.annotations.toList()<|endoftext|>


Prompt:
override val fqName: FqName
        get() = klass.classId.asSingleFqName()

    override val outerClass: ReflectJavaClass?
        get() = klass.declaringClass?.let(::ReflectJavaClass)

    override val supertypes: Collection<JavaClassifierType>
        get() {

Response:
if (klass == Any::class.java) return emptyList()
            return listOf(klass.genericSuperclass ?: Any::class.java, *klass.genericInterfaces).map(::ReflectJavaClassifierType)
        }

    override val methods: List<ReflectJavaMethod>
        get() = klass.declaredMethods
            .asSequence()
            .filter { method -><|endoftext|>


Prompt:
relativeRootPath: String,
    excludeDirsRecursively: List<String> = listOf(),
    excludedPattern: String? = null,
) {
    model(
        relativeRootPath = relativeRootPath,
        extension = data.defaultExtension(),
        excludeDirsRecursively = excludeDirsRecursively,
        excludedPattern = excludedPattern,
    )
}

Response:
private fun TestGroup.analysisApiTestClass(
    data: AnalysisApiTestConfiguratorFactoryData,
    testClass: Class<*>,
    init: TestGroup.TestClass.(data: AnalysisApiTestConfiguratorFactoryData) -> Unit
) {
    val factory = AnalysisApiConfiguratorFactoryProvider.getFactory(data) ?: return

    val fullPackage = getPackageName(data, testClass)<|endoftext|>


Prompt:
) { it, _ -> args[it] }
            patchSerializableClassWithMarkerAnnotation(serializer.owner)
            +irReturn(requireNotNull(expr))
        }
        generateSerializerFactoryIfNeeded(methodDescriptor)
    }

    private fun getOrCreateSerializerVarargFactory(): IrSimpleFunction {
        irClass.findDeclaration<IrSimpleFunction> {

Response:
it.name == SerialEntityNames.SERIALIZER_PROVIDER_NAME
                    && it.valueParameters.size == 1
                    && it.valueParameters.first().isVararg
                    && it.returnType.isKSerializer()
                    && it.isFromPlugin(compilerContext.afterK2)
        }?.let { return it }<|endoftext|>


Prompt:
const val equalsInt1 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1.equals(2)<!>
const val equalsInt2 = 2 == 2
const val equalsInt3 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1.equals("1")<!>

Response:
const val equalsInt4 = <!EQUALITY_NOT_APPLICABLE!>1 == "1"<!>

const val equalsLong1 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1L.equals(2L)<!>
const val equalsLong2 = 2L == 2L<|endoftext|>


Prompt:
class TestIdenticalReturnTypesReverse {
    constructor()
}
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun TestIdenticalReturnTypesReverse(): TestIdenticalReturnTypesReverse = TestIdenticalReturnTypesReverse()

class TestFunctionWithReifiedTypeParameterVsConstructorA<T> {

Response:
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) constructor()
}
inline fun <reified T> TestFunctionWithReifiedTypeParameterVsConstructorA() {}

class TestFunctionWithReifiedTypeParameterVsConstructorAReverse<T> {
    constructor()
}<|endoftext|>


Prompt:
_seed.value = seed
    }

    override fun nextBits(bitCount: Int): Int {
        update((seed * MULTIPLIER + 0xbL) and ((1L shl 48) - 1))
        return (seed ushr (48 - bitCount)).toInt()
    }

    override fun nextInt(): Int = nextBits(32)
}

Response:
internal actual fun defaultPlatformRandom(): Random = NativeRandom

internal actual fun doubleFromParts(hi26: Int, low27: Int): Double =
        (hi26.toLong().shl(27) + low27) / (1L shl 53).toDouble()<|endoftext|>


Prompt:
@kotlin.internal.InlineOnly
public inline operator fun DoubleArray.component2(): Double {
    return get(1)
}

/**
 * Returns 2nd *element* from the array.
 *
 * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS
 * where the behavior is unspecified.
 */

Response:
@kotlin.internal.InlineOnly
public inline operator fun BooleanArray.component2(): Boolean {
    return get(1)
}

/**
 * Returns 2nd *element* from the array.
 *
 * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS
 * where the behavior is unspecified.
 */<|endoftext|>


Prompt:
import org.jetbrains.kotlin.resolve.bindingContextUtil.getDataFlowInfoBefore
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
import org.jetbrains.kotlin.resolve.calls.smartcasts.SmartCastManager
import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver

Response:
import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension
import org.jetbrains.kotlin.resolve.scopes.*
import org.jetbrains.kotlin.resolve.scopes.receivers.ClassQualifier
import org.jetbrains.kotlin.resolve.scopes.utils.collectAllFromMeAndParent<|endoftext|>


Prompt:
* applied to elements of the given array.
 *
 * If any of two pairs would have the same key the last one gets added to the map.
 *
 * The returned map preserves the entry iteration order of the original array.
 *
 * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitives
 */

Response:
public inline fun <K, V> FloatArray.associate(transform: (Float) -> Pair<K, V>): Map<K, V> {
    val capacity = mapCapacity(size).coerceAtLeast(16)
    return associateTo(LinkedHashMap<K, V>(capacity), transform)
}

/**
 * Returns a [Map] containing key-value pairs provided by [transform] function<|endoftext|>


Prompt:
// JVM_ABI_K1_K2_DIFF: KT-63864
// WITH_STDLIB

import kotlin.test.*

val sb = StringBuilder()

abstract class A<in T> {
    abstract fun foo(x: T)
}

class B : A<Int>() {
    override fun foo(x: Int) {

Response:
sb.appendLine("B: $x")
    }
}

class C : A<Any>() {
    override fun foo(x: Any) {
        sb.appendLine("C: $x")
    }
}

fun foo(arg: A<Int>) {
    arg.foo(42)
}

fun box(): String {
    foo(B())
    foo(C())<|endoftext|>


Prompt:
if ("0".hashCode() == 42) return@l
        return@l <!NULL_FOR_NONNULL_TYPE!>null<!>
    }
}

Response:
val expectedNullableUnitExplicitReturnUnitAndString: () -> Unit? = <!INITIALIZER_TYPE_MISMATCH("kotlin.Function0<kotlin.Unit?>; kotlin.Function0<kotlin.Any>")!>l@ {
    if ("0".hashCode() == 42) return@l Unit
    ""
}<!><|endoftext|>


Prompt:
reifiedAsFailsWithCCE<Function8<*, *, *, *, *, *, *, *, *>>(
                    x, "x as Function8<*, *, *, *, *, *, *, *, *>")
}

object TestFn9 : TestFnBase {
    override fun testGood(x: Any) =

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


Prompt:
val b = data.getOrPut("foo") { 3 }
        assertEquals(2, b)

        assertEquals(1, data.size)
    }

    @Test fun emptyMapGet() {
        val map = emptyMap()
        assertEquals(null, map.get("foo"), """failed on map.get("foo")""")

Response:
assertEquals(null, map["bar"], """failed on map["bar"]""")
    }

    @Test fun mapGet() {
        val map = createTestMap()
        for (i in KEYS.indices) {
            assertEquals(VALUES[i], map.get(KEYS[i]), """failed on map.get(KEYS[$i])""")<|endoftext|>


Prompt:
* Returns the value for the given [key] or throws an exception if there is no such key in the map.
 *
 * If the map was created by [withDefault], resorts to its `defaultValue` provider function
 * instead of throwing an exception.
 *
 * @throws NoSuchElementException when the map doesn't contain a value for the specified key and
 * no implicit default value was provided for that map.
 */

Response:
@SinceKotlin("1.1")
public fun <K, V> Map<K, V>.getValue(key: K): V = getOrImplicitDefault(key)

/**
 * Returns the value for the given [key] if the value is present and not `null`.
 * Otherwise, calls the [defaultValue] function,
 * puts its result into the map under the given key and returns the call result.
 *<|endoftext|>


Prompt:
assertEquals(0.0, subject.nextDouble(0.0.nextUp()))
        }

        assertTrue(subject.nextDouble(Double.POSITIVE_INFINITY).isFinite(), "Infinity is exclusive")

        for (bound in listOf(1.0, 100.0, 1024.0, Double.MAX_VALUE)) {
            repeat(1000) {

Response:
val d = subject.nextDouble(bound)
                if (!(d >= 0.0 && d < bound)) {
                    fail("Random double $d is out of range [0, $bound)")
                }
            }
        }
    }

    @Test
    fun nextDoubleFromUntil() {<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_PARAMETER

const val u1: UByte = 0xFFu
const val u2: UShort = 0xFFFFu
const val u3: UInt = 0xFFFF_FFFFu
const val u4: ULong = 0xFFFF_FFFF_FFFF_FFFFu
const val u5: ULong = 18446744073709551615u

Response:
const val u6 = 0xFFFF_FFFF_FFFF_FFFFu
const val u7 = 18446744073709551615u

val u8: Comparable<*> = 0xFFFF_FFFF_FFFF_FFFFu

const val u9 = 0xFFFF_FFFF_FFFF_FFFFUL

fun takeUByte(ubyte: UByte) {}

fun test() {<|endoftext|>


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

object StandaloneModeConfigurator : StandaloneModeConfiguratorBase() {

    override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
        sourceConfigurator.configureTest(builder, disposable)

Response:
// `StandaloneModeConfiguratorBase` is ordered last so that it overrules the source test configuration.
        super.configureTest(builder, disposable)
    }

    private val sourceConfigurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)

    override val serviceRegistrars: List<AnalysisApiTestServiceRegistrar><|endoftext|>


Prompt:
assertEquals(Long.MIN_VALUE, minOf(Long.MAX_VALUE, Long.MIN_VALUE))
        assertEquals(Long.MIN_VALUE, minOf(Long.MAX_VALUE, Long.MIN_VALUE, 0))
        assertEquals(Long.MIN_VALUE, minOf(Long.MAX_VALUE, Long.MIN_VALUE, 0, -1))

Response:
assertEquals(Double.NEGATIVE_INFINITY, minOf(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY))
        assertEquals(Double.MIN_VALUE, minOf(Double.POSITIVE_INFINITY, Double.MAX_VALUE, Double.MIN_VALUE))<|endoftext|>


Prompt:
visitElement(anonymousObject)
    }

    final override fun visitAnonymousObjectExpression(anonymousObjectExpression: FirAnonymousObjectExpression, data: Nothing?) {
        visitAnonymousObjectExpression(anonymousObjectExpression)
    }

    open fun visitAnonymousObjectExpression(anonymousObjectExpression: FirAnonymousObjectExpression) {
        visitElement(anonymousObjectExpression)
    }

Response:
final override fun visitDiagnosticHolder(diagnosticHolder: FirDiagnosticHolder, data: Nothing?) {
        visitDiagnosticHolder(diagnosticHolder)
    }

    open fun visitDiagnosticHolder(diagnosticHolder: FirDiagnosticHolder) {
        visitElement(diagnosticHolder)
    }<|endoftext|>


Prompt:
override val op = 5
        override val ap = 5
    }

    interface C {
        val c: Int
    }

    interface D<T> : C {
        override val c: Int
    }

    interface E
    class G : B(), C, D<Int>, E

    class InheritAny {
        interface SomeTrait
        interface SomeTrait2

Response:
class ImplicitAny

        class ExplicitAny : Any()

        class OnlyTrait : SomeTrait
        class OnlyTraits : SomeTrait, SomeTrait2

        class TraitWithExplicitAny : Any(), SomeTrait
        class TraitsWithExplicitAny : SomeTrait2, Any(), SomeTrait
    }

    abstract class InheritFunctionType : ((Int, String) -> Int)<|endoftext|>


Prompt:
if (isEqualAnyNullableLeft(A(0), A(1))) return "Fail 25"
    if (!isEqualAnyNullableRight<Int>(null, null)) return "Fail 26"
    if (!isEqualAnyNullableRight(A(0), A(0))) return "Fail 27"
    if (isEqualAnyNullableRight(0, A(0))) return "Fail 28"

Response:
if (isEqualAnyNullableRight<Int>(0, null)) return "Fail 29"
    if (isEqualAnyNullableRight(null, A(0))) return "Fail 30"
    if (isEqualAnyNullableRight(A(0), A(1))) return "Fail 31"
    if (isEqualNullableUnboxedLeft(A(0), A(1))) return "Fail 32"<|endoftext|>


Prompt:
@JavaAnn(value = <!ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM_ANNOTATION_ERROR, TYPE_MISMATCH!>"value"<!>)
fun test4() {}

@JavaAnn("value", path = arrayOf("path"))
fun test5() {}

@JavaAnn("value", path = ["path"])

Response: fun test6() {}<|endoftext|>


Prompt:
val (major, minor, patch) = message?.version ?: VersionRequirement.Version.INFINITY
    v.version = KmVersion(major, minor, patch)
    return v
}

@ExperimentalContracts
private fun ProtoBuf.Contract.toKmContract(c: ReadContext): KmContract {
    val v = KmContract()
    for (effect in effectList) {

Response:
if (!effect.hasEffectType()) continue

        val effectType = when (requireNotNull(effect.effectType)) {
            ProtoBuf.Effect.EffectType.RETURNS_CONSTANT -> KmEffectType.RETURNS_CONSTANT
            ProtoBuf.Effect.EffectType.CALLS -> KmEffectType.CALLS<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
}

/*
 * TESTCASE NUMBER: 8
 * UNEXPECTED BEHAVIOUR
 * ISSUES: KT-13650
 */
fun case_8(x: Class?, y: String?) {

Response:
x?.prop_12 = if (y === null) throw Exception() else ""
    <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>y<!>
    <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
}<|endoftext|>


Prompt:
assertEquals(J.FLOAT_NULL == null, true)
    assertEquals(J.DOUBLE_NULL == null, true)

    return "OK"
}

// FILE: J.java
public class J {
    public static Boolean BOOL_NULL = null;
    public static Character CHAR_NULL = null;
    public static Byte BYTE_NULL = null;

Response:
public static Short SHORT_NULL = null;
    public static Integer INT_NULL = null;
    public static Long LONG_NULL = null;
    public static Float FLOAT_NULL = null;
    public static Double DOUBLE_NULL = null;
}<|endoftext|>


Prompt:
listOf("E", "D", "C", "B", "A")
        )
    }

    fun testRepeatedEdges() {
        checkGraph(
            """
            A; B; C
            C > B; C > B; B > A; C > A
        """.trimIndent(),
            listOf("C", "B", "A")
        )
    }

Response:
fun testSelfLoopReport() {
        val graph = parseFromString(
            """
            A
            A > A
        """.trimIndent()
        )
        assertFails { topologicalSort(graph.nodes, dependencies = { graph.edges[this].orEmpty() }) }
    }

    fun testDirectLoopReport() {
        val graph = parseFromString(
            """<|endoftext|>


Prompt:
<!DIRECTIVES("WITH_STDLIB")!>

val <!ELEMENT(1)!> = {`false`: Boolean -> !`false` }

fun f1(value: Pair<String, String>): Boolean {
    val (<!ELEMENT(2)!>, <!ELEMENT(3)!>) = value

    if (<!ELEMENT(2)!> != "1") return false

Response:
if (<!ELEMENT(3)!> != "2") return false

    return true
}

fun box(): String? {
    var i = 0
    for (<!ELEMENT(4)!>: Int in 0..10) {
        i++
    }

    if (!<!ELEMENT(1)!>(false)) return null<|endoftext|>


Prompt:
// MODULE: platform-jvm()()(common)
// FILE: B_J.java
public class B_J extends A {
    public String foo() { return "O"; }
}

// FILE: C2_J.java
public class C2_J extends B_J {
    public String foo() { return "K"; }
}

// FILE: main.kt
actual class C1 : B_J()

Response:
actual typealias C2 = C2_J

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


Prompt:
kaptClasspath.files.toList(),
                    allDataFiles
                )
                .writeToCache()

            KaptIncrementalChanges.Unknown
        }
    }

    private fun loadPreviousSnapshot(
        cacheDir: File,
        allDataFiles: MutableSet<File>,
        changedFiles: MutableSet<File>
    ): ClasspathSnapshot {

Response:
val loadedPrevious = ClasspathSnapshot.ClasspathSnapshotFactory.loadFrom(cacheDir)

        val previousAndCurrentDataFiles = lazy { loadedPrevious.getAllDataFiles() + allDataFiles }
        val allChangesRecognized = changedFiles.all {
            val extension = it.extension
            if (extension.isEmpty() || extension == "java" || extension == "jar" || extension == "class") {<|endoftext|>


Prompt:
fun change(newStatus: String) {
        status = newStatus
    }
}

class ConeClassLikeErrorLookupTag : ConeClassLikeLookupTag() {
    override val status: String
        get() = "ERROR"
}

fun ConeClassLikeLookupTag.foo(): String {

Response:
(this as? ConeClassLikeLookupTagImpl)?.status?.takeIf { it == "OK" }?.let { return it }
    return status.also {
        (this as? ConeClassLikeLookupTagImpl)?.bar(it)
    }
}

fun ConeClassLikeLookupTagImpl.bar(s: String) {
    change(s)
}<|endoftext|>


Prompt:
text = if (openingStartOffset < closingStartOffset) {
                requireNotNull(opening)
                val openingMatch = Opening(counter++, opening.groups[2]!!.value, opening.range.first)
                openings.addLast(openingMatch)
                stackOfOpenings.addLast(openingMatch)
                text.removeRange(openingStartOffset, opening.range.last + 1)
            } else {

Response:
requireNotNull(closing)
                closingOffsets[stackOfOpenings.removeLast()] = closing.range.first
                text.removeRange(closingStartOffset, closing.range.last + 1)
            }
        }
        if (openings.size != closingOffsets.size) {
            error("Opening and closing tags counts are not equals")
        }
        while (!openings.isEmpty()) {<|endoftext|>


Prompt:
assertEquals(1, js("j %= 2"), "%=")
    }

    assertEquals(undefined, js("(void 0)"), "void")
    assertEquals(true, js("'key' in {'key': 10}"), "in")
    assertEquals("string", js("typeof 'str'"), "typeof")

Response:
assertEquals(true, js("new String('str') instanceof String"), "instanceof")

    var s: Any = js("({key: 10})")
    assertEquals(undefined, js("delete s.key, s.key"), "delete")

    return "OK"
}<|endoftext|>


Prompt:
// FIR_IDENTICAL
interface IBase {
    override fun toString(): String
}

interface IDerived : IBase

object BaseImpl : IBase {
    override fun toString(): String = "A"
}

object DerivedImpl : IDerived {
    override fun toString(): String = "A"
}

class Test1 : IBase by BaseImpl

Response: class Test2 : IDerived by DerivedImpl<|endoftext|>


Prompt:
val nonInteractiveDecision = target.providers.gradleProperty(CONSENT_DECISION_GRADLE_PROPERTY).map { it.toBoolean() }
                if (isInIdea && !nonInteractiveDecision.isPresent) {
                    throw CannotRequestConsentWithinIdeException(setupFile.consentDetailsLink)
                }

Response:
val consentReceived = if (nonInteractiveDecision.isPresent) {
                    consentManager.applyConsentDecision(nonInteractiveDecision.get(), setupFile.consentDetailsLink)
                } else {
                    consentManager.askForConsent(setupFile.consentDetailsLink)
                }
                if (!consentReceived) {<|endoftext|>


Prompt:
*  fun foo__externalAdapter(x: KotlinType): KotlinType = adaptResult(foo(adaptParameter(x)));
     */
    fun transformExternalFunction(function: IrSimpleFunction): List<IrDeclaration>? {
        // External functions with default parameter values are already processed by
        // [ComplexExternalDeclarationsToTopLevelFunctionsLowering]

Response:
if (function.valueParameters.any { it.defaultValue != null })
            return null

        // Patch function types for Number parameters as double
        function.returnType = doubleIfNumber(function.returnType)

        val valueParametersAdapters = function.valueParameters.map { parameter ->
            val varargElementType = parameter.varargElementType
            if (varargElementType != null) {<|endoftext|>


Prompt:
package org.jetbrains.kotlin.analysis.test.framework

import com.intellij.openapi.Disposable
import com.intellij.openapi.util.Disposer
import org.jetbrains.kotlin.test.TestConfiguration
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest

Response:
import org.jetbrains.kotlin.test.services.isKtFile
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.TestInfo

abstract class AbstractCompilerBasedTest : AbstractKotlinCompilerTest() {
    private var _disposable: Disposable? = null<|endoftext|>


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

import kotlin.reflect.*

interface A
interface B : A

fun A.foo() {}

fun take(f: (A) -> Unit) {}
fun take(f: () -> Unit) {}

fun test() {
    B::foo checkType { _<KFunction1<B, Unit>>() }

Response:
<!NONE_APPLICABLE!>take<!>(B::foo)
}<|endoftext|>


Prompt:
annotations += c.annotationDeserializer.loadAnnotations(
                    ktParameter
                )
            }
        }.toList()
    }

    private fun KtTypeReference.toTypeRef(context: StubBasedFirDeserializationContext): FirTypeRef =
        context.typeDeserializer.typeRef(this)

    fun loadEnumEntry(
        declaration: KtEnumEntry,

Response:
symbol: FirRegularClassSymbol,
        classId: ClassId
    ): FirEnumEntry {
        val enumEntryName = declaration.name
            ?: errorWithAttachment("Enum entry doesn't provide name") {
                withPsiEntry("declaration", declaration)
            }<|endoftext|>


Prompt:
fun create(psiJavaModule: PsiJavaModule) = JavaModuleInfo(
            psiJavaModule.name,
            psiJavaModule.requires.mapNotNull { statement ->
                statement.moduleName?.let { moduleName ->
                    Requires(moduleName, statement.hasModifierProperty(PsiModifier.TRANSITIVE))
                }
            },

Response:
psiJavaModule.exports.mapNotNull { statement ->
                statement.packageName?.let { packageName ->
                    Exports(FqName(packageName), statement.moduleNames)
                }
            },
            psiJavaModule.annotations.convert {
                JavaAnnotationImpl(
                    JavaElementSourceFactory.getInstance(psiJavaModule.project).createPsiSource(it)
                )<|endoftext|>


Prompt:
abstract class AbstractFirOutOfContentRootLazyBodiesCalculatorTest : AbstractFirLazyBodiesCalculatorTest() {
    override val configurator = AnalysisApiFirOutOfContentRootTestConfigurator
}

abstract class AbstractFirScriptLazyBodiesCalculatorTest : AbstractFirLazyBodiesCalculatorTest() {

Response:
override val configurator = AnalysisApiFirScriptTestConfigurator(analyseInDependentSession = false)
}<|endoftext|>


Prompt:
public inline fun BooleanArray.sumOf(selector: (Boolean) -> Long): Long {
    var sum: Long = 0.toLong()
    for (element in this) {
        sum += selector(element)
    }
    return sum
}

/**
 * Returns the sum of all values produced by [selector] function applied to each element in the array.
 */
@SinceKotlin("1.4")

Response:
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("sumOfLong")
@kotlin.internal.InlineOnly
public inline fun CharArray.sumOf(selector: (Char) -> Long): Long {
    var sum: Long = 0.toLong()<|endoftext|>


Prompt:
// Auto-generated by GeneratePrimitiveVsObjectEqualityTestData. Do not edit!

val nx: Long? = 0L
val nn: Long? = null
val x: Long = 0L
val y: Long = 1L

fun box(): String {
    val ax: Long? = 0L
    val an: Long? = null
    val bx: Long = 0L

Response:
val by: Long = 1L

    return when {
        nx != 0L -> "Fail 0"
        nx == 1L -> "Fail 1"
        !(nx == 0L) -> "Fail 2"
        !(nx != 1L) -> "Fail 3"
        nx != x -> "Fail 4"
        nx == y -> "Fail 5"<|endoftext|>


Prompt:
regex = Regex("(p[0-9]*)#?(q[0-9]*)")

        result = regex.find("p1#q3p2q42p5p71p63#q888")
        assertNotNull(result)
        assertEquals(0, result!!.range.start)
        assertEquals(5, result.range.endInclusive + 1)

Response:
assertEquals(3, result.groups.size)
        assertEquals(0, result.groups[0]!!.range.start)
        assertEquals(5, result.groups[0]!!.range.endInclusive + 1)
        assertEquals(0, result.groups[1]!!.range.start)<|endoftext|>


Prompt:
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode

Response:
import org.jetbrains.kotlin.name.CallableId
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.jvm.AsmTypes<|endoftext|>


Prompt:
initC2TC(0x0d, TC_WS)
    initC2TC(0x20, TC_WS)
    initC2TC(COMMA, TC_COMMA)
    initC2TC(COLON, TC_COLON)
    initC2TC(BEGIN_OBJ, TC_BEGIN_OBJ)

Response:
initC2TC(END_OBJ, TC_END_OBJ)
    initC2TC(BEGIN_LIST, TC_BEGIN_LIST)
    initC2TC(END_LIST, TC_END_LIST)
    initC2TC(STRING, TC_STRING)
    initC2TC(STRING_ESC, TC_STRING_ESC)
}<|endoftext|>


Prompt:
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.EnvironmentConfigurator
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.util.KtTestUtil
import org.jetbrains.kotlin.utils.PathUtil

Response:
import java.io.File

private fun getLibraryJar(classToDetect: String): File? = try {
    PathUtil.getResourcePathForClass(Class.forName(classToDetect))
} catch (e: ClassNotFoundException) {
    null
}

class ParcelizeEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfigurator(testServices) {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.incremental.multiproject.ModulesApiHistory
import org.jetbrains.kotlin.incremental.util.BufferingMessageCollector
import org.jetbrains.kotlin.incremental.util.Either
import org.jetbrains.kotlin.load.java.JavaClassesTracker

Response:
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
import org.jetbrains.kotlin.modules.TargetId
import org.jetbrains.kotlin.name.ClassId<|endoftext|>


Prompt:
override fun report(reporter: DiagnosticReporter) {
        reporter.onCallReceiver(receiver, this)
    }
}

// candidates result
class NoneCandidatesCallDiagnostic : KotlinCallDiagnostic(INAPPLICABLE) {
    override fun report(reporter: DiagnosticReporter) {
        reporter.onCall(this)
    }
}

Response:
class ManyCandidatesCallDiagnostic(val candidates: Collection<ResolutionCandidate>) : KotlinCallDiagnostic(INAPPLICABLE) {
    override fun report(reporter: DiagnosticReporter) {
        reporter.onCall(this)
    }
}<|endoftext|>


Prompt:
}
}

object Demo {
    val i0 by Delegate { ICInt(1) }
    val l0 by Delegate { ICLong(2L) }
    val o0 by Delegate { ICOverIC(ICLong(3L)) }

    val i1: ICInt by Delegate { ICInt(11) }

Response:
val l1: ICLong by Delegate { ICLong(22) }
    val o1: ICOverIC by Delegate { ICOverIC(ICLong(33)) }

    var i2 by Delegate { ICInt(0) }
    var l2 by Delegate { ICLong(0) }
    var o2 by Delegate { ICOverIC(ICLong(0)) }
}<|endoftext|>


Prompt:
class ArgumentTypeMismatch(
    val expectedType: ConeKotlinType,
    val actualType: ConeKotlinType,
    val argument: FirExpression,
    val isMismatchDueToNullability: Boolean,
) : ResolutionDiagnostic(INAPPLICABLE)

class NullForNotNullType(
    val argument: FirExpression, val expectedType: ConeKotlinType

Response:
) : ResolutionDiagnostic(INAPPLICABLE)

class ManyLambdaExpressionArguments(
    val argument: FirExpression
) : ResolutionDiagnostic(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR)

class InfixCallOfNonInfixFunction(val function: FirNamedFunctionSymbol) : ResolutionDiagnostic(CONVENTION_ERROR)<|endoftext|>


Prompt:
System.getProperty("os.name")?.also { metricConsumer.report(StringMetrics.OS_TYPE, System.getProperty("os.name")) }
            metricConsumer.report(NumericalMetrics.CPU_NUMBER_OF_CORES, Runtime.getRuntime().availableProcessors().toLong())

Response:
metricConsumer.report(BooleanMetrics.EXECUTED_FROM_IDEA, System.getProperty("idea.active") != null)
            metricConsumer.report(NumericalMetrics.GRADLE_DAEMON_HEAP_SIZE, Runtime.getRuntime().maxMemory())<|endoftext|>


Prompt:
k.setSomething("")
    k.something = ""
}

fun useString(i: String) {}

// FILE: JavaInterface1.java
public interface JavaInterface1 {
    String getSomething();
}

// FILE: JavaInterface2.java
public interface JavaInterface2 {
    void setSomething(String value);
}

// FILE: JavaInterface3.java

Response: public interface JavaInterface3 extends JavaInterface1, JavaInterface2 {}<|endoftext|>


Prompt:
class A() {
    <!CONFLICTING_OVERLOADS!>fun b()<!> {
    }

    <!CONFLICTING_OVERLOADS!>@Deprecated("a", level = DeprecationLevel.HIDDEN) fun b()<!> {
    }
}

open class B() {

Response:
<!CONFLICTING_OVERLOADS!>open fun b()<!> {
    }

    <!CONFLICTING_OVERLOADS!>@Deprecated("a", level = DeprecationLevel.HIDDEN) fun b()<!> {
    }
}

open class C() {
    <!CONFLICTING_OVERLOADS!>fun b()<!> {
    }<|endoftext|>


Prompt: $i$a$-f2-LibraryKt$foo$2\64\510\56:int=0:int, $i$f$test\65\506:int=0:int, testVal\65:int=1:int

Response: // library.kt:25 box: $i$f$foo\56\65:int=0:int, array\56:java.lang.Integer[]=java.lang.Integer[], myClass\56:MyClass=MyClass, this_\62:MyClass=MyClass, $i$f$f2\62\506:int=0:int,<|endoftext|>


Prompt:
fun Any?.toResultString(): String =
    if (this == null) "OK" else "!! $this"

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

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

Response:
res = (base.generic() as IC).s.toResultString()
    }
    return res!!
}<|endoftext|>


Prompt:
buffer.append(postfix)
    return buffer
}

/**
 * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.
 *
 * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]

Response:
* elements will be appended, followed by the [truncated] string (which defaults to "...").
 *
 * @sample samples.collections.Collections.Transformations.joinTo
 */<|endoftext|>


Prompt:
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) <!CONFLICTING_OVERLOADS!>constructor(arg: Invariant<T>)<!>
        <!CONFLICTING_OVERLOADS!>constructor(arg: Invariant<T>)<!>
    }

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


Prompt:
* Inserts the string representation of the specified double [value] into this string builder at the specified [index] and returns this instance.
     *
     * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
     * and then that string was inserted into this string builder at the specified [index].
     *

Response:
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
     */
    public actual fun insert(index: Int, value: Double): StringBuilder = insert(index, value.toString())

    /**
     * Inserts the specified character [value] into this string builder at the specified [index] and returns this instance.
     *<|endoftext|>


Prompt:
val valueParametersCount = constructorDescriptor.valueParameters.size + constructorDescriptor.contextReceiverParameters.size
            return IrConstructorCallImpl(
                startOffset, endOffset,
                type,
                constructorSymbol,
                typeArgumentsCount = totalTypeParametersCount,
                constructorTypeArgumentsCount = totalTypeParametersCount - classTypeParametersCount,
                valueArgumentsCount = valueParametersCount,

Response:
origin = origin
            )
        }

        fun fromSymbolOwner(
            startOffset: Int,
            endOffset: Int,
            type: IrType,
            constructorSymbol: IrConstructorSymbol,
            classTypeParametersCount: Int,
            origin: IrStatementOrigin? = null
        ): IrConstructorCallImpl {
            val constructor = constructorSymbol.owner<|endoftext|>


Prompt:
package a

fun foo() : Int {
    try {
        doSmth()
    }
    catch (e: Exception) {
        return <!RETURN_TYPE_MISMATCH!>""<!>
    }
    finally {
        return <!RETURN_TYPE_MISMATCH!>""<!>
    }
}

fun bar() : Int =

Response:
<!RETURN_TYPE_MISMATCH!>try {
        doSmth()
    }
    catch (e: Exception) {
        ""
    }
    finally {
        ""
    }<!>

fun doSmth() {}<|endoftext|>


Prompt:
val argAfterSpreadEmptyVararg = create(11, *arrayOf(), o = 123456L)
    if (argAfterSpreadEmptyVararg.size != 2 || js("typeof argAfterSpreadEmptyVararg[0] !== 'number'"))
        return "fail9: $argAfterSpreadEmptyVararg arguments"

    return "OK"
}

// FILE: main.js
function create() {
    return arguments

Response: }<|endoftext|>


Prompt:
package delegate

import kotlin.reflect.KProperty

class Delegate() {
    inline operator fun getValue(thisRef: Any?, property: KProperty<*>): String {
        return "I'm your val"
    }

    inline operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) {

Response:
println("$value has been assigned to '${property.name}' in $thisRef.")
    }
}<|endoftext|>


Prompt:
contextReceivers.addAll(convertContextReceivers(owner.contextReceivers))
                    if (!owner.hasModifier(EXTERNAL_KEYWORD) || isExplicitDelegationCall()) {
                        delegatedConstructor = buildOrLazyDelegatedConstructorCall(
                            isThis = isDelegatedCallToThis(),
                            constructedTypeRef = delegatedTypeRef,
                        ) {

Response:
getDelegationCall().convert(delegatedTypeRef)
                        }
                    }
                    this@PsiRawFirBuilder.context.firFunctionTargets += target
                    extractAnnotationsTo(this)
                    typeParameters += constructorTypeParametersFromConstructedClass(ownerTypeParameters)
                    extractValueParametersTo(this, symbol, ValueParameterDeclaration.FUNCTION)<|endoftext|>


Prompt:
// TESTCASE NUMBER: 5
fun case_5(value_1: Int?, value_2: Int?) {
    if (case_5_1(value_1)) {
        <!DEBUG_INFO_SMARTCAST!>value_1<!>.inv()
        if (case_5_2(value_1)) {

Response:
<!DEBUG_INFO_SMARTCAST!>value_1<!>.<!UNREACHABLE_CODE!>inv()<!>
            <!UNREACHABLE_CODE!><!DEBUG_INFO_SMARTCAST!>value_1<!>.inv()<!>
        }
    }
    if (!case_5_3(value_2)) {<|endoftext|>


Prompt:
project.projectDir.resolve("local.properties").writeText(
            """
            a = local
            c = local
            x = "local"
            """.trimIndent()
        )

        project.gradle.registerMinimalVariantImplementationFactoriesForTests()
        val properties = PropertiesBuildService.registerIfAbsent(project).get()

Response:
assertEquals("extra", properties.get("a", project))
        assertEquals("extra", properties.get("b", project))
        assertEquals("local", properties.get("c", project))
        assertEquals(null, properties.get("d", project))
        assertEquals("\"local\"", properties.get("x", project))
    }

}<|endoftext|>


Prompt:
IrTypeOperator.INSTANCEOF -> {
                val isInstance = isErased || state.isSubtypeOf(typeOperand)
                callStack.pushState(environment.convertToState(isInstance, irBuiltIns.booleanType))
            }
            IrTypeOperator.NOT_INSTANCEOF -> {
                val isInstance = isErased || state.isSubtypeOf(typeOperand)

Response:
callStack.pushState(environment.convertToState((!isInstance), irBuiltIns.booleanType))
            }
            IrTypeOperator.IMPLICIT_NOTNULL -> {
                when {
                    state.isNull() && !typeOperand.isNullable() -> NullPointerException().handleUserException(environment)
                    else -> callStack.pushState(state)
                }
            }<|endoftext|>


Prompt:
package org.jetbrains.kotlin.ir.backend.js.transformers.irToJs

import org.jetbrains.kotlin.ir.backend.js.utils.JsMainFunctionDetector
import org.jetbrains.kotlin.utils.addToStdlib.runIf
import org.jetbrains.kotlin.utils.putToMultiMap

Response:
typealias CachedTestFunctionsWithTheirPackage = Map<String, List<String>>

interface PerFileGenerator<Module, File, Artifact> {
    val mainModuleName: String

    val Module.isMain: Boolean
    val Module.fileList: Iterable<File>

    val Artifact.artifactName: String
    val Artifact.hasEffect: Boolean
    val Artifact.hasExport: Boolean<|endoftext|>


Prompt:
val test6
        /**
         * comment
         */
        get() = 42

    val test7
        @Suppress(
            "UNUSED_VARIABLE"
        )
        get() = 42

    var test8 = 42

    var test9 = 42; private set

    var test10 = 42
        private set

    var test11 = 42

Response:
set(value) {
            field = value
        }

    var test12 = 42
        /**
         * comment
         */
        set(value) {
            field = value
        }

    var test13 = 42
        @Suppress(
            "UNUSED_VARIABLE"
        )
        set(value) {
            field = value
        }

}<|endoftext|>


Prompt:
return "raw ($lowerRendered..$upperRendered)"
        }
        if (upperBound.arguments.isEmpty()) return renderer.renderFlexibleType(lowerRendered, upperRendered, builtIns)

        val lowerArgs = renderArguments(lowerBound)
        val upperArgs = renderArguments(upperBound)

Response:
val newArgs = lowerArgs.joinToString(", ") { "(raw) $it" }
        val newUpper =
            if (lowerArgs.zip(upperArgs).all { onlyOutDiffers(it.first, it.second) })
                upperRendered.replaceArgs(newArgs)
            else upperRendered
        val newLower = lowerRendered.replaceArgs(newArgs)<|endoftext|>


Prompt:
fun testClass3(x : objcnames.protocols.FwdProtocol) = x::class
fun testClass4() {
    <!FORWARD_DECLARATION_AS_CLASS_LITERAL!>cnames.structs.FwdStruct::class<!>

Response:
<!FORWARD_DECLARATION_AS_CLASS_LITERAL!>objcnames.classes.FwdObjcClass::class<!>
    <!FORWARD_DECLARATION_AS_CLASS_LITERAL!>objcnames.protocols.FwdProtocol::class<!>
}
inline fun <reified T> inlineF(x: T) {}<|endoftext|>


Prompt: $i$a$-foo-LibraryKt$flaf$1\2\25\0$iv:int=0:int, x\2$iv:int=1:int, fooParam\5$iv:int=2:int, $i$f$foo\5\17:int=0:int, fooVar\5$iv:int=0:int

Response: // library.kt:8 box: $i$f$flaf:int=0:int, flafVar$iv:int=0:int, fooParam\1$iv:int=0:int, $i$f$foo\1\12:int=0:int, fooVar\1$iv:int=0:int, it\2$iv:int=42:int,<|endoftext|>


Prompt:
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T: Invariant<UserInterface>> testTypeParameterWithVarianceDifferentUpperBoundsC() {}
fun <T: Invariant<*>> testTypeParameterWithVarianceDifferentUpperBoundsC() {}

fun <T: Invariant<UserInterface>> testTypeParameterWithVarianceDifferentUpperBoundsCReverse() {}

Response:
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T: Invariant<*>> testTypeParameterWithVarianceDifferentUpperBoundsCReverse() {}

@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T: Invariant<out UserInterface>> testTypeParameterWithVarianceDifferentUpperBoundsD() {}<|endoftext|>


Prompt:
task.dependencies.set(cocoapodsExtension.pods)
            task.artifactType.set(artifactType)
        }

        assembleTask.dependsOn(podspecTask)
    }

    private fun injectPodspecExtensionToArtifacts(
        project: Project,
        artifactsExtension: KotlinArtifactsExtension,

Response:
cocoapodsExtension: CocoapodsExtension,
    ) {
        artifactsExtension.artifactConfigs.withType(KotlinNativeArtifactConfig::class.java) { artifactConfig ->
            val podspecExtension = project.objects.newInstance<KotlinArtifactsPodspecExtension>()<|endoftext|>


Prompt:
UNDEFINED_OFFSET,
        type,
        origin,
        branches
    )

    protected fun irBranch(
        condition: IrExpression,
        result: IrExpression
    ): IrBranch {
        return IrBranchImpl(condition, result)
    }

    protected fun irElseBranch(
        expression: IrExpression,

Response:
startOffset: Int = UNDEFINED_OFFSET,
        endOffset: Int = UNDEFINED_OFFSET
    ) = IrElseBranchImpl(startOffset, endOffset, irConst(true), expression)

    protected fun irBlock(
        type: IrType = context.irBuiltIns.unitType,
        origin: IrStatementOrigin? = null,
        statements: List<IrStatement><|endoftext|>


Prompt:
val <T> List<T>.a: Int get() = size
    val <T> List<T>.b: Int? get() = size

    fun <T> List<T>.testCallable1(): () -> Unit = a::foo

Response: fun <T> List<T>.testCallable1a(): () -> Unit = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>a<T><!>::foo<|endoftext|>


Prompt:
case501 checkType { check<Char>()}
}
// TESTCASE NUMBER: 502
fun case502(){
   val case502 = '\ufaff'
   <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char")!>case502<!>
   case502 checkType { check<Char>()}
}
// TESTCASE NUMBER: 503
fun case503(){

Response:
val case503 = '\ufb00'
   <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char")!>case503<!>
   case503 checkType { check<Char>()}
}
// TESTCASE NUMBER: 504
fun case504(){
   val case504 = '\ufbff'<|endoftext|>


Prompt:
scopeSession: ScopeSession,
    returnTypeCalculator: ReturnTypeCalculator = ReturnTypeCalculatorForFullBodyResolve.Default,
    outerBodyResolveContext: BodyResolveContext? = null,
) : FirAbstractBodyResolveTransformerDispatcher(
    session,
    phase,
    implicitTypeOnly,
    scopeSession,
    returnTypeCalculator,

Response:
outerBodyResolveContext,
) {
    final override val expressionsTransformer = FirExpressionsResolveTransformer(this)
    final override val declarationsTransformer = FirDeclarationsResolveTransformer(this)
}<|endoftext|>


Prompt:
override fun javacOptions(action: KaptJavacOption.() -> Unit) {
        javacOptionsActions += action
    }

    override fun getJavacOptions(): Map<String, String> {
        val result = KaptJavacOptionsDelegate()
        javacOptionsActions.forEach { it(result) }
        return result.options
    }

Response:
fun getAdditionalArguments(project: Project, variantData: Any?, androidExtension: Any?): Map<String, String> {
        val result = KaptAnnotationProcessorOptions(project, variantData, androidExtension)
        apOptionsActions.forEach { it(result) }
        return result.options
    }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.test.frontend.classic.handlers.FirTestDataConsistencyHandler
import org.jetbrains.kotlin.test.model.DependencyKind
import org.jetbrains.kotlin.test.model.FrontendKinds
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest

Response:
import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator

abstract class AbstractParcelizeDiagnosticTest : AbstractKotlinCompilerTest() {
    override fun TestConfigurationBuilder.configuration() {
        globalDefaults {<|endoftext|>


Prompt: 0xc00921fb5442cd40UL,     0xc00921fb5444171bUL,     0xbd8bffb390866e47UL,     0xbd8bffb390860c49UL,

Response: 0xbd8bffb39086d045UL,     0xbd9bffb390866e47UL,     0xbd7bffb390866e47UL,     0xbdabffb390866e47UL,<|endoftext|>


Prompt:
val localDelegatedValByProvider by Provider(1)
    var localDelegatedVarByProvider by Provider(2)

    val x = C()
    if (x.delegatedVal != 1) throw AssertionError()
    if (x.delegatedVar != 2) throw AssertionError()
    x.delegatedVar = 3

Response:
if (x.delegatedVar != 3) throw AssertionError()

    if (x.delegatedValByProvider != 1) throw AssertionError()
    if (x.delegatedVarByProvider != 2) throw AssertionError()
    x.delegatedVarByProvider = 3
    if (x.delegatedVarByProvider != 3) throw AssertionError()<|endoftext|>


Prompt:
//Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto_tcs.proto

package org.jetbrains.kotlin.gradle.idea.proto.generated.tcs;

@kotlin.jvm.JvmName("-initializeideaKotlinClasspathProto")

Response: inline fun ideaKotlinClasspathProto(block: org.jetbrains.kotlin.gradle.idea.proto.generated.tcs.IdeaKotlinClasspathProtoKt.Dsl.() -> kotlin.Unit): org.jetbrains.kotlin.gradle.idea.proto.generated.tcs.IdeaKotlinClasspathProto =<|endoftext|>


Prompt:
if (nullability.canBeNull() && !nullability.canBeNonNull()) {
            if (!TypeUtils.isNullableType(expectedReceiverParameterType)) {
                reportUnsafeCall = true
            }
            if (dataFlowValue.immanentNullability.canBeNonNull()) {
                expression?.let { trace.record(BindingContext.SMARTCAST_NULL, it) }
            }

Response:
} else if (!nullableImplicitInvokeReceiver && smartCastNeeded) {
            // Look if smart cast has some useful nullability info

            val smartCastResult = smartCastManager.checkAndRecordPossibleCast(
                dataFlowValue, expectedReceiverParameterType,
                expression, this, candidateCall.call, recordExpressionType = true<|endoftext|>


Prompt:
methodFound = true

                        recordLocalTypesForParameters(access, desc)

                        object : MethodVisitor(Opcodes.API_VERSION) {
                            // ASM labels cannot be easily compared across to visits of the same method.
                            // Therefore, we keep our own numbering that is consistent across multiple
                            // visits.
                            private var currentLabelNumber = 0

                            // Record local load and store instructions for each basic block.

Response:
override fun visitVarInsn(opcode: Int, index: Int) {
                                currentBlock.addInstruction(index, opcode)
                            }

                            // Build control-flow graph based on jump instructions.
                            override fun visitJumpInsn(opcode: Int, label: Label?) {
                                when (opcode) {
                                    Opcodes.IFEQ,
                                    Opcodes.IFNE,<|endoftext|>


Prompt:
val declarationDescriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, simpleNameExpression)
    return when (declarationDescriptor) {
        is VariableDescriptor -> {
            val resolvedCall = simpleNameExpression.getResolvedCall(bindingContext)

            // todo uncomment assert
            // KT-4113

Response:
// for now it fails for resolving 'invoke' convention, return it after 'invoke' algorithm changes
            // assert resolvedCall != null : "Cannot create right identifier info if the resolved call is not known yet for
            val usageModuleDescriptor = DescriptorUtils.getContainingModuleOrNull(containingDeclarationOrModule)
            val selectorInfo = IdentifierInfo.Variable(
                declarationDescriptor,<|endoftext|>


Prompt:
if (newValue >= 0L) Long.MAX_VALUE else newValue
        }
        assertEquals(Long.MAX_VALUE, l.value)
        r.lazySet(A("aaaa"))
        r.update { cur ->
            A("cccc${cur.s}")
        }
        assertEquals("ccccaaaa", r.value.s)
    }

Response:
fun atomicfuUpdateAndGetTest() {
        val res1 = a.updateAndGet { value ->
            if (value >= 0) Int.MAX_VALUE else value
        }
        assertEquals(Int.MAX_VALUE, res1)
        assertTrue(b.updateAndGet { true })
        val res2 = l.updateAndGet { cur -><|endoftext|>


Prompt:
// See also KT-4285
open class A {
    open fun foo(x: Int = 0) {}

    open fun gav(y: Int = 1, z: Int = 2) {}
}

class B: A() {
    <!NO_TAIL_CALLS_FOUND!>tailrec<!> override fun foo(x: Int) {

Response:
<!NON_TAIL_RECURSIVE_CALL!>foo<!>()
    }

    <!NO_TAIL_CALLS_FOUND!>tailrec<!> override fun gav(y: Int, z: Int) {
        <!NON_TAIL_RECURSIVE_CALL!>gav<!>(y)
    }<|endoftext|>


Prompt:
println("destinationDir     : $destinationDir")
            println("artifact           : $artifact")
            println("klibFiles          : ${libraries.klibFiles.dump()}")
            println("                   : ${libraries.artifacts.map {
                it.artifact.canonicalPath
            }.dump()}")
            println("defFile            : $defFile")
            println("target             : $target")

Response:
println("packageName        : $packageName")
            println("compilerOpts       : $compilerOpts")
            println("linkerOpts         : $linkerOpts")
            println("headers            : ${headers.dump()}")
            println("linkFiles          : ${linkFiles.dump()}")
            println("konanVersion       : ${KotlinVersion.CURRENT}")
            println()<|endoftext|>


Prompt:
package org.jetbrains.kotlin.types

import org.jetbrains.kotlin.descriptors.annotations.Annotated
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.renderer.DescriptorRenderer

Response:
import org.jetbrains.kotlin.renderer.DescriptorRendererOptions
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner
import org.jetbrains.kotlin.types.checker.StrictEqualityTypeChecker<|endoftext|>


Prompt:
val currentLineCounter = AtomicInteger()

    fun nextCodeLine(code: String): ReplCodeLine = ReplCodeLine(currentLineCounter.getAndIncrement(), 0, code)

    val replCompiler: JvmReplCompiler by lazy {
        JvmReplCompiler(simpleScriptCompilationConfiguration)
    }

    val compiledEvaluator: ReplEvaluator by lazy {

Response:
JvmReplEvaluator(simpleScriptEvaluationConfiguration)
    }

    val state by lazy {
        val stateLock = ReentrantReadWriteLock()
        AggregatedReplStageState(replCompiler.createState(stateLock), compiledEvaluator.createState(stateLock), stateLock)
    }

    override fun close() {
        state.dispose()<|endoftext|>


Prompt:
class Case5 constructor(x: Any = <!NULL_FOR_NONNULL_TYPE!>null<!>)

// TESTCASE NUMBER: 6
class Case6 {
    fun foo(x: Nothing = <!NULL_FOR_NONNULL_TYPE!>null<!>) {}
}

// TESTCASE NUMBER: 7
class Case7 {

Response:
val x: Int get() = <!NULL_FOR_NONNULL_TYPE!>null<!>
}

// TESTCASE NUMBER: 8
class Case8 {
    var x: Any = 0
        get() = 0
        set(value) {
            field = <!NULL_FOR_NONNULL_TYPE!>null<!>
        }
}<|endoftext|>


Prompt:
}

/*
 * TESTCASE NUMBER: 3
 * UNEXPECTED BEHAVIOUR
 * ISSUES: KT-31053
 */
fun case_3(x: Any?) {
    if (x is Nothing?) throw Exception()
    <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!>

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

/*
 * TESTCASE NUMBER: 4
 * UNEXPECTED BEHAVIOUR
 * ISSUES: KT-31053
 */
fun case_4(x: Pair<*, *>?) {
    when (x) {<|endoftext|>


Prompt:
val x = object<!TYPE_PARAMETERS_IN_ANONYMOUS_OBJECT!><T><!> {
        fun test() = 10 <!UNCHECKED_CAST!>as T<!>
    }

    val z = x.test()

    if (z is T) {
        // z is {T!! & T!!} (smart cast from T)

Response:
<!UNRESOLVED_REFERENCE!>println<!>(z)
    }

    val a = object<!TYPE_PARAMETERS_IN_ANONYMOUS_OBJECT!><A><!> {
        fun test() = 42 <!UNCHECKED_CAST!>as A<!>
    }

    val b = a.test()

    if (a is T) {<|endoftext|>


Prompt:
"Debugger.scriptParsed" -> json.decodeFromJsonElement(Debugger.Event.ScriptParsed.serializer(), params)
        "Runtime.executionContextCreated" -> json.decodeFromJsonElement(Runtime.Event.ExecutionContextCreated.serializer(), params)

Response:
"Runtime.executionContextDestroyed" -> json.decodeFromJsonElement(Runtime.Event.ExecutionContextDestroyed.serializer(), params)
        else -> UnknownCDPEvent(method)
    }
}

/**
 * Something capable of invoking a [Chrome DevTools protocol](https://chromedevtools.github.io/devtools-protocol/) method and returning
 * the result of the invocation.
 */<|endoftext|>


Prompt:
is FakeDirectory -> current = value.contents
                    is FakeFile -> if (components.isNotEmpty()) return null
                    null -> return null
                }
            }
            return value
        }

        fun subdirectoryAt(path: Path): FakeDirectory {
            when (val directory = fileSystemAt(path)) {
                is FakeDirectory -> return directory
                is FakeFile -> error("Path $path is a file")

Response:
null -> error("Subdirectory $path doesn't exist")
            }
        }

        fun exists(path: Path): Boolean = fileSystemAt(path) != null

        fun walkFileSystemFrom(path: Path): Sequence<FakeFileSystem> {
            return sequence {
                walkFileSystem(subdirectoryAt(path))
            }
        }

        private suspend fun SequenceScope<FakeFileSystem>.walkFileSystem(<|endoftext|>


Prompt:
if (!mapper.shouldBeExposed(classDescriptor)) {
            // There are number of tricky corner cases getting here.
            return ObjCIdType
        }

        return if (classDescriptor.isInterface) {
            ObjCProtocolType(referenceProtocol(classDescriptor).objCName)
        } else {
            val typeArgs = if (objcGenerics) {

Response:
kotlinType.arguments.map { typeProjection ->
                    if (typeProjection.isStarProjection) {
                        ObjCIdType // TODO: use Kotlin upper bound.
                    } else {
                        mapReferenceTypeIgnoringNullability(typeProjection.type, objCExportScope)
                    }
                }
            } else {
                emptyList()
            }<|endoftext|>


Prompt:
// JSPECIFY_STATE: warn

// FILE: Foo.java
import org.jspecify.nullness.Nullable;

public class Foo {
    public static <T> void gauge(@Nullable T stateObject) {}
}

// FILE: main.kt
fun <T> test(metric: T) {
    if (metric is String) {

Response:
Foo.gauge(<!DEBUG_INFO_SMARTCAST!>metric<!>)
    }
}<|endoftext|>


Prompt:
package org.jetbrains.kotlin.android.synthetic.codegen

import kotlinx.android.extensions.CacheImplementation
import org.jetbrains.kotlin.ir.declarations.IrClass

class CliAndroidIrExtension(val isExperimental: Boolean, private val globalCacheImpl: CacheImplementation) : AndroidIrExtension() {

Response:
override fun isEnabled(declaration: IrClass) = true
    override fun isExperimental(declaration: IrClass) = isExperimental
    override fun getGlobalCacheImpl(declaration: IrClass) = globalCacheImpl
}<|endoftext|>


Prompt:
disposed = true
        clearCache()
    }

    protected open fun nonScriptId(locationId: String): Boolean =
        nonScriptFilenameSuffixes.any {
            locationId.endsWith(it, ignoreCase = true)
        }

    override fun findDefinition(script: SourceCode): ScriptDefinition? =

Response:
if (script.locationId == null || nonScriptId(script.locationId!!)) {
            null
        } else {
            cachedDefinitions.firstOrNull { it.isScript(script) }
        }

    @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
    override fun findScriptDefinition(fileName: String): KotlinScriptDefinition? =<|endoftext|>


Prompt:
}
                    }
                }
            )
        }
    }

    private fun loadKnownThirdPartyCodeList(): List<String> {
        File("license/README.md").useLines { lineSequence ->
            return lineSequence
                .filter { it.startsWith(" - Path: ") }

Response:
.map { it.removePrefix(" - Path: ").trim().ensureFileOrEndsWithSlash() }
                .toList()

        }
    }

    fun testLanguageFeatureOrder() {
        val values = enumValues<LanguageFeature>()
        val enabledFeatures = values.filter { it.sinceVersion != null }<|endoftext|>


Prompt:
* | START | ---------------------->| SUSPENDED |
 * +-------+                        +-----------+
 *                probeCoroutineResumed |   ^ probeCoroutineSuspended
 *                                      V   |
 *                                  +------------+ completion invoked  +-----------+
 *                                  |   RUNNING  | ------------------->| COMPLETED |
 *                                  +------------+                     +-----------+
 * ```
 *

Response:
* While the coroutine is resumed and suspended, it is represented by the pointer to its `frame`
 * which always extends [BaseContinuationImpl] and represents a pointer to the topmost frame of the
 * coroutine. Each [BaseContinuationImpl] object has [completion][BaseContinuationImpl.completion] reference
 * that points either to another frame (extending [BaseContinuationImpl]) or to the completion object<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char")!>case316<!>
   case316 checkType { check<Char>()}
}
// TESTCASE NUMBER: 317
fun case317(){
   val case317 = '\u9e00'
   <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char")!>case317<!>

Response:
case317 checkType { check<Char>()}
}
// TESTCASE NUMBER: 318
fun case318(){
   val case318 = '\u9eff'
   <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char")!>case318<!>
   case318 checkType { check<Char>()}
}
// TESTCASE NUMBER: 319
fun case319(){<|endoftext|>


Prompt:
typeDistance(classifiers, target, typeB, idOfA)
        )

        assertEquals(
            CirTypeDistance(-1),
            typeDistance(classifiers, target, typeA, idOfB)
        )

        assertEquals(
            CirTypeDistance(2),
            typeDistance(classifiers, target, typeC, idOfA)
        )

        assertEquals(

Response:
CirTypeDistance(-2),
            typeDistance(classifiers, target, typeA, idOfC)
        )

        assertEquals(
            CirTypeDistance(3),
            typeDistance(classifiers, target, typeD, idOfA)
        )

        assertEquals(
            CirTypeDistance(-3),
            typeDistance(classifiers, target, typeA, idOfD)<|endoftext|>


Prompt:
private val samConstructorForTypeAliasConstructor =
        storageManager.createMemoizedFunctionWithNullableValues<Pair<ClassConstructorDescriptor, TypeAliasDescriptor>, TypeAliasConstructorDescriptor> { (constructor, typeAliasDescriptor) ->
            TypeAliasConstructorDescriptorImpl.createIfAvailable(storageManager, typeAliasDescriptor, constructor)
        }

Response:
private fun extensionForFunctionNotCached(function: FunctionDescriptor): FunctionDescriptor? {
        if (!function.visibility.isVisibleOutside()) return null
        if (!function.hasJavaOriginInHierarchy()) return null //TODO: should we go into base at all?
        if (!JavaSingleAbstractMethodUtils.isSamAdapterNecessary(function)) return null<|endoftext|>


Prompt:
firDiagnostic: KtPsiDiagnostic,
    token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtExpression>(firDiagnostic, token), KtFirDiagnostic.UnsafeInfixCall

internal class UnsafeOperatorCallImpl(
    override val receiverType: KtType,

Response:
override val receiverExpression: KtExpression,
    override val operator: String,
    override val argumentExpression: KtExpression?,
    firDiagnostic: KtPsiDiagnostic,
    token: KtLifetimeToken,<|endoftext|>


Prompt:
val parentFir = selectorExpression.getOrBuildFir(analysisSession.firResolveSession)
            if (parentFir is FirResolvedQualifier) {
                var classId = parentFir.classId
                while (unresolvedCounter > 0) {
                    unresolvedCounter--
                    classId = classId?.outerClassId
                }

Response:
return listOfNotNull(classId?.toTargetPsi(session, symbolBuilder))
            }
            parent = parent.parent as? KtDotQualifiedExpression
            unresolvedCounter++
        }
        return emptyList()
    }

    private fun getSymbolsByResolvable(
        fir: FirResolvable,
        expression: KtSimpleNameExpression,<|endoftext|>


Prompt:
isInNotCall = prevIsInNotCall
                                return
                            }
                        }
                    }
                }
            }
            val opSymbol = when (name) {
                "contains" -> "in"
                "equals" -> if (isInNotCall) "!=" else "=="
                "plus" -> "+"
                "not" -> "!"
                "minus" -> "-"

Response:
"times" -> "*"
                "div" -> "/"
                "rem" -> "%"
                "rangeTo" -> ".."
                "plusAssign" -> "+="
                "minusAssign" -> "-="
                "unaryMinus" -> "-"
                "timesAssign" -> "*="
                "divAssign" -> "/="
                "remAssign" -> "%="<|endoftext|>


Prompt:
/** Returns a [Duration] representing the specified [value] number of seconds. */
        @SinceKotlin("1.5")
        @ExperimentalTime
        @Deprecated("Use 'Long.seconds' extension property from Duration.Companion instead.", ReplaceWith("value.seconds", "kotlin.time.Duration.Companion.seconds"))

Response:
@DeprecatedSinceKotlin(warningSince = "1.6", errorSince = "1.8", hiddenSince = "1.9")
        public fun seconds(value: Long): Duration = value.toDuration(DurationUnit.SECONDS)

        /**
         * Returns a [Duration] representing the specified [value] number of seconds.
         *<|endoftext|>


Prompt:
for(i in 0..getExtensionCount(KlibMetadataProtoBuf.constructorAnnotation) - 1) {
        hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.constructorAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById)
    }

    return hashCode
}

Response:
fun ProtoBuf.EnumEntry.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int {
    var hashCode = 1

    if (hasName()) {
        hashCode = 31 * hashCode + stringIndexes(name)
    }<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_PARAMETER
// NI_EXPECTED_FILE
import kotlin.reflect.KProperty

var a: Int by A()

Response: var a1 by <!CANNOT_INFER_PARAMETER_TYPE, CANNOT_INFER_PARAMETER_TYPE, DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>A()<!><|endoftext|>


Prompt:
override fun equals(other: Any?): Boolean {
        error("Do not try comparing ByteArrayCharSequence")
    }

    override val length get() = end - start

    override fun get(index: Int): Char = bytes[index + start].toInt().toChar()

    override fun subSequence(startIndex: Int, endIndex: Int): CharSequence {

Response:
if (startIndex == 0 && endIndex == length) return this
        return ByteArrayCharSequence(bytes, start + startIndex, start + endIndex)
    }

    override fun toString(): String {
        val chars = CharArray(length)

        for (i in 0 until length) {
            chars[i] = bytes[i + start].toInt().toChar()
        }<|endoftext|>


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

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

Response:
value_1 == false -> ""
}

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


Prompt:
@Deprecated(SHORTCUTS_DEPRECATION_MESSAGE)
    fun tvos(namePrefix: String, configure: Action<KotlinNativeTarget>) = tvos(namePrefix) { configure.execute(this) }

    @Deprecated(SHORTCUTS_DEPRECATION_MESSAGE)

Response:
fun tvos(configure: Action<KotlinNativeTarget>) = tvos { configure.execute(this) }

    @Deprecated(SHORTCUTS_DEPRECATION_MESSAGE)
    fun watchos(
        namePrefix: String = "watchos",
        configure: KotlinNativeTarget.() -> Unit = {},
    ) {<|endoftext|>


Prompt:
val annotator = ClosureAnnotator(irElement, container)

            localFunctions.forEach { (declaration, context) ->
                context.closure = annotator.getFunctionClosure(declaration)
            }

            localClasses.forEach { (declaration, context) ->
                context.closure = annotator.getClassClosure(declaration)
            }
        }

Response:
private fun collectLocalDeclarations() {
            val enclosingPackageFragment = container.getPackageFragment()
            val enclosingClass = run {
                var currentParent = container as? IrClass ?: container.parent
                while (currentParent is IrDeclaration && currentParent !is IrClass) {
                    currentParent = currentParent.parent
                }

                currentParent as? IrClass
            }<|endoftext|>


Prompt:
private const val LANGUAGE_DIRECTIVE = "LANGUAGE"
        private val INCOMPATIBLE_LANGUAGE_SETTINGS = setOf(
            "-ProperIeee754Comparisons",                            // K/N supports only proper IEEE754 comparisons
            "-ReleaseCoroutines",                                   // only release coroutines
            "-DataClassInheritance",                                // old behavior is not supported

Response:
"-ProhibitAssigningSingleElementsToVarargsInNamedForm", // Prohibit these assignments
            "-ProhibitDataClassesOverridingCopy",                   // Prohibit as no longer supported
            "-ProhibitOperatorMod",                                 // Prohibit as no longer supported
            "-ProhibitIllegalValueParameterUsageInDefaultArguments",  // Allow only legal values<|endoftext|>


Prompt:
if (project.isCompatibilityMetadataVariantEnabled) {
                val mainCompilation = target.compilations.getByName(KotlinCompilation.MAIN_COMPILATION_NAME)
                configureMetadataDependenciesForCompilation(mainCompilation)
            }

            sourceSetsWithMetadataCompilations.values.forEach { compilation ->

Response:
exportDependenciesForPublishing(compilation)
            }

            target.metadataCompilationsCreated.complete()
        }
    }

    private suspend fun isMetadataCompilationSupported(sourceSet: KotlinSourceSet): Boolean {
        val platforms = sourceSet.internal.awaitPlatformCompilations()
            .filter { it.target !is KotlinMetadataTarget }<|endoftext|>


Prompt:
printer.printCollection(value.values, separator = ", ", prefix = "[", postfix = "]") {
                    renderConstantValueDebug(it, printer)
                }
            }

            is KtEnumEntryAnnotationValue -> {
                printer.append(value.callableId?.asSingleFqName()?.render())
            }

            is KtConstantAnnotationValue -> {

Response:
printer.append(value.constantValue.constantValueKind.asString)
                    .append("(")
                    .append(value.constantValue.value.toString())
                    .append(")")
            }

            KtUnsupportedAnnotationValue -> {
                printer.append(KtUnsupportedAnnotationValue::class.java.simpleName)
            }<|endoftext|>


Prompt:
public final fun setRange(startIndex: kotlin.Int, endIndex: kotlin.Int, value: kotlin.String): kotlin.text.StringBuilder

    public open override fun subSequence(startIndex: kotlin.Int, endIndex: kotlin.Int): kotlin.CharSequence

    @kotlin.SinceKotlin(version = "1.4")

Response:
public final fun substring(startIndex: kotlin.Int): kotlin.String

    @kotlin.SinceKotlin(version = "1.4")
    public final fun substring(startIndex: kotlin.Int, endIndex: kotlin.Int): kotlin.String

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


Prompt:
interface MaybeStable
        """,
        """
            @Composable fun MaybeStable.example(x: Int) {
                used(this)
                used(x)
            }
            val example: @Composable MaybeStable.(Int) -> Unit = {
                used(this)
                used(it)
            }
        """
    )

    @Test

Response:
fun testArrayDefaultArgWithState(): Unit = comparisonPropagation(
        """
        """,
        """
            import androidx.compose.runtime.MutableState

            @Composable
            fun VarargComposable(state: MutableState<Int>, vararg values: String = Array(1) { "value " + it }) {
                state.value
            }
        """
    )<|endoftext|>


Prompt:
<!CONFLICTING_OVERLOADS!>fun testVarianceDifferentReturnTypesBReverse(): Invariant<UserKlass><!> = Invariant()
<!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun testVarianceDifferentReturnTypesBReverse(): Invariant<in UserKlass><!> = Invariant()

Response:
<!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun testVarianceDifferentReturnTypesC(): Invariant<UserKlass><!> = Invariant()
<!CONFLICTING_OVERLOADS!>fun testVarianceDifferentReturnTypesC(): Invariant<*><!> = Invariant<UserKlass>()<|endoftext|>


Prompt:
configuration: CompilerConfiguration
    ): KotlinCoreEnvironment

    abstract fun createScriptEvaluator(): ScriptEvaluator
    abstract fun createScriptCompiler(environment: KotlinCoreEnvironment): ScriptCompilerProxy

    protected abstract fun ScriptEvaluationConfiguration.Builder.platformEvaluationConfiguration()

    override fun eval(
        arguments: CommonCompilerArguments,

Response:
configuration: CompilerConfiguration,
        projectEnvironment: KotlinCoreEnvironment.ProjectEnvironment
    ): ExitCode {
        val messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
        val scriptDefinitionProvider = ScriptDefinitionProvider.getInstance(projectEnvironment.project)
        if (scriptDefinitionProvider == null) {<|endoftext|>


Prompt:
is ProtoBuf.Function, is ProtoBuf.Constructor -> AnnotatedCallableKind.FUNCTION
        else -> throw IllegalStateException("Unsupported message: $this")
    }

fun Name.ref() = StringRef.fromString(this.asString())!!

fun FqName.ref() = StringRef.fromString(this.asString())!!

Response:
fun computeParameterName(name: Name): Name {
    return when {
        name == SpecialNames.IMPLICIT_SET_PARAMETER -> StandardNames.DEFAULT_VALUE_PARAMETER
        SpecialNames.isAnonymousParameterName(name) -> Name.identifier("_")
        else -> name
    }
}<|endoftext|>


Prompt:
val excludedBinaryOperations = listOf("rangeUntil").map { Name.identifier(it) }

    for (classDescriptor in allPrimitiveTypes + additionalBuiltIns + arrays) {
        val compileTimeFunctions = classDescriptor.unsubstitutedMemberScope.getContributedDescriptors()
            .filterIsInstance<CallableDescriptor>()

Response:
.filter { !it.isFakeOverride(classDescriptor) && it.valueParameters.size + 1 == argumentsCount }
            .filter { it.name !in excludedBinaryOperations }

        for (function in compileTimeFunctions) {
            val parameterTypes = listOf(classDescriptor.defaultType.constructor.toString()) +
                    function.valueParameters.map { it.type.toString() }<|endoftext|>


Prompt:
findMissingSuperTypes(symbol)
        }

    fun getMissingSuperTypes(declaration: FirClassSymbol<*>): Set<ConeKotlinType> {
        return cache.getValue(declaration, null)
    }

    private fun findMissingSuperTypes(declaration: FirClassSymbol<*>): Set<ConeKotlinType> {

Response:
return declaration.collectSuperTypes(session)
            .filterTo(mutableSetOf()) {
                // Ignore types which are already errors.
                it !is ConeErrorType && it !is ConeDynamicType && it.toSymbol(session) == null
            }
    }

    private fun FirClassSymbol<*>.collectSuperTypes(session: FirSession): Set<ConeKotlinType> {<|endoftext|>


Prompt:
JsBinaryOperator.ASG_SHRU -> JsAstProtoBuf.BinaryOperation.Type.ASG_SHRU
        JsBinaryOperator.ASG_BIT_AND -> JsAstProtoBuf.BinaryOperation.Type.ASG_BIT_AND

Response:
JsBinaryOperator.ASG_BIT_OR -> JsAstProtoBuf.BinaryOperation.Type.ASG_BIT_OR
        JsBinaryOperator.ASG_BIT_XOR -> JsAstProtoBuf.BinaryOperation.Type.ASG_BIT_XOR
        JsBinaryOperator.COMMA -> JsAstProtoBuf.BinaryOperation.Type.COMMA<|endoftext|>


Prompt:
// Reference to function with context receivers does not currently support memoization.
    @Test
    fun testNonComposableFunctionReferenceWithStableContextReceiverNotMemoized() {
        verifyGoldenComposeIrTransform(
            source = """
                import androidx.compose.runtime.Composable
                import androidx.compose.runtime.remember

                class StableReceiver
                class Stable {

Response:
context(StableReceiver)
                    fun qux() {}
                }

                @Composable
                fun Something() {
                    val x = remember { Stable() }
                    val shouldNotMemoize = x::qux
                }
            """
        )
    }

    @Test
    fun testUnstableReceiverFunctionReferenceNotMemoized() = verifyGoldenComposeIrTransform(
        """<|endoftext|>


Prompt:
testServices.ktTestModuleStructure.mainAndBinaryKtModules,
            testServices.environmentManager.getProjectEnvironment()
        )
    }

    override fun getProject(module: TestModule): Project {
        return testServices.environmentManager.getProject()
    }

    override fun getCompilerConfiguration(module: TestModule): CompilerConfiguration {

Response:
return configurationCache.getOrPut(module) {
            createKotlinCompilerConfiguration(module)
        }
    }

    override fun getPackagePartProviderFactory(module: TestModule): (GlobalSearchScope) -> JvmPackagePartProvider {
        val configuration = getCompilerConfiguration(module)

        return { scope ->
            JvmPackagePartProvider(configuration.languageVersionSettings, scope).apply {<|endoftext|>


Prompt:
originalBody.transformChildrenVoid(object : IrElementTransformerVoid() {
                // Replace returns to refer to the new function.
                override fun visitReturn(expression: IrReturn): IrExpression {
                    expression.transformChildrenVoid(this)

                    return if (expression.returnTargetSymbol != transformingFunction.symbol)
                        expression
                    else
                        irReturn(expression.value)
                }

Response:
// Replace function arguments loading with properties reading.
                override fun visitGetValue(expression: IrGetValue): IrExpression {
                    expression.transformChildrenVoid(this)

                    val capturedValue = argumentToPropertiesMap[expression.symbol.owner]
                            ?: return expression
                    return irGetField(irGet(thisReceiver), capturedValue)
                }<|endoftext|>


Prompt:
IrClassReferenceImpl(
            UNDEFINED_OFFSET, UNDEFINED_OFFSET, irBuiltIns.kClassClass.starProjectedType, irBuiltIns.kClassClass, classType
        )

    private fun buildIrGet(
        type: IrType,
        receiver: IrExpression?,
        getterSymbol: IrFunctionSymbol
    ): IrCall = IrCallImpl(

Response:
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
        type,
        getterSymbol as IrSimpleFunctionSymbol,
        typeArgumentsCount = getterSymbol.owner.typeParameters.size,
        valueArgumentsCount = 0,
        origin = IrStatementOrigin.GET_PROPERTY
    ).apply {
        dispatchReceiver = receiver
    }<|endoftext|>


Prompt:
return CliBindingTrace::class.java.name
    }

    fun setKotlinCodeAnalyzer(kotlinCodeAnalyzer: KotlinCodeAnalyzer) {
        this.kotlinCodeAnalyzer = kotlinCodeAnalyzer
    }

    @Suppress("UNCHECKED_CAST")

Response:
override fun <K, V> get(slice: ReadOnlySlice<K, V>, key: K): V? {
        val value = super.get(slice, key)

        if (value == null) {
            if (key is KtDeclaration) {
                // NB: intentional code duplication, see https://youtrack.jetbrains.com/issue/KT-43296<|endoftext|>