Prompt:
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.types.*

Response:
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.ir.util.functions
import org.jetbrains.kotlin.ir.util.isClass
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.Variance<|endoftext|>


Prompt:
serializer(typeOf<Container.NestedEnumWithCustomCl>()).checkSerialName("custom|Container.NestedEnumWithCustomCl")?.let { return it }
    // generated serializer used in lookup for the empty module  in case of specifying of @file:UseContextualSerialization or @UseSerializers

Response:
serializer(typeOf<EnumWithUseContextual>()).checkSerialName("EnumWithUseContextual")?.let { return it }
    // generated serializer used in lookup for the empty module  in case of specifying of @file:UseContextualSerialization or @UseSerializers<|endoftext|>


Prompt:
// No error, even while `Final` belongs to a different module and "equals" contract might be changed without re-compilation
        // But since we had such behavior in FE1.0, it might be too strict to prohibit it now, especially once there's a lot of cases
        // when different modules belong to a single project, so they're totally safe (see KT-50534)
        takeIntFinal(x)
    }

Response:
if (x === y) {
        takeIntFinal(x) // OK
    }
}

fun testBase(x: Base<*>, y: Base<Int>) {
    if (x == y) {
        takeIntBase(<!ARGUMENT_TYPE_MISMATCH!>x<!>) // Error
    }
    if (x === y) {
        takeIntBase(x) // OK<|endoftext|>


Prompt:
N()
          }
        }
        """
    )

    @Test
    fun testOpenOverrideInferredToAgree() = check(
        """
        import androidx.compose.runtime.Composable
        import androidx.compose.runtime.ComposableTarget

        @Composable @ComposableTarget("N") fun N() { }

Response:
@Composable @ComposableTarget("M") fun M() { }

        abstract class Base {
          @Composable @ComposableTarget("N") abstract fun Compose()
        }

        class Invalid : Base() {
          @Composable override fun Compose() {
            N()
          }
        }
        """)
}<|endoftext|>


Prompt:
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL

// MODULE: m1
// FILE: a.kt
package p

public interface B {
    public fun String.getParent(): B?
}

// MODULE: m2(m1)
// FILE: b.kt
package p

public class C : B {

Response:
override fun String.getParent(): B? = null

}

// MODULE: m3
// FILE: b.kt
package p

public interface B {
    public fun String.getParent(): B?
}

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

fun B.test() {
    if (this is C) {<|endoftext|>


Prompt:
<!DIRECTIVES("HELPERS: REFLECT")!>

@file:<!ELEMENT(1)!>
@file:<!ELEMENT(2)!>

@Target(AnnotationTarget.FILE)
annotation class <!ELEMENT(1)!>

@Target(AnnotationTarget.FILE)
annotation class <!ELEMENT(2)!>

fun box(): String? {

Response:
if (!checkFileAnnotations("<!CLASS_OF_FILE!>", listOf("<!ELEMENT_VALIDATION(1)!>", "<!ELEMENT_VALIDATION(2)!>"))) return null
    if (!checkClassName(<!ELEMENT(1)!>::class, "<!ELEMENT_VALIDATION(1)!>")) return null<|endoftext|>


Prompt:
val questionMark = if (hasDefaultValue && couldBeOptional) "?" else ""
        return "$name$questionMark: ${type.toTypeScript(indent)}"
    }

    private fun IrClass.asNestedClassAccess(): String {
        val name = getJsNameOrKotlinName().identifier
        if (parent !is IrClass) return name

Response:
return "${parentAsClass.asNestedClassAccess()}.$name"
    }

    private fun ExportedType.toTypeScript(indent: String, isInCommentContext: Boolean = false): String = when (this) {
        is ExportedType.Primitive -> typescript
        is ExportedType.Array -> "Array<${elementType.toTypeScript(indent, isInCommentContext)}>"<|endoftext|>


Prompt:
var ts = A(Array<Int>(2, {it}), IntArray(3)).toString()
    if(ts != "A(x=[0, 1], y=[0, 0, 0])") return ts

    ts = A(null, IntArray(3)).toString()
    if(ts != "A(x=null, y=[0, 0, 0])") return ts

Response:
ts = A(null, null).toString()
    if(ts != "A(x=null, y=null)") return ts

    return "OK"
}<|endoftext|>


Prompt:
expression.transformChildren(this, data)

                if (expression.superQualifierSymbol == null && expression.symbol.owner.isOverridable)
                    ++callSitesCount
                val devirtualizedCallSite = devirtualizedCallSites[expression] ?: return expression
                val possibleCallees = devirtualizedCallSite.possibleCallees.groupBy {

Response:
if (it.receiverType is DataFlowIR.Type.External) return expression
                    it.callee as? DataFlowIR.FunctionSymbol.Declared ?: return expression
                }.entries.map { entry ->
                    entry.key to entry.value.map { it.receiverType as DataFlowIR.Type.Declared }.distinct()
                }<|endoftext|>


Prompt:
sourceModule.getModuleDescriptor(it)
            }

            val diagnosticsReporter = DiagnosticReporterFactory.createPendingReporter()
            generateKLib(
                sourceModule,
                outputKlibPath,
                nopack = arguments.irProduceKlibDir,
                jsOutputName = arguments.irPerModuleOutputName,
                icData = icData,

Response:
moduleFragment = moduleFragment,
                diagnosticReporter = diagnosticsReporter,
                builtInsPlatform = if (arguments.wasm) BuiltInsPlatform.WASM else BuiltInsPlatform.JS,
                wasmTarget = if (!arguments.wasm) null else arguments.wasmTarget?.let(WasmTarget::fromName)
            )<|endoftext|>


Prompt:
assertEquals("[63]zoo(42)bar{31}foo;[12]abc(34)def{56}ghi;{99}xyz[88]xyz(77)xyz;", s)
        s = regex.replace(target, repl)

Response:
assertEquals("[63]zoo(42)bar{31}foo;[56]ghi(34)def{12}abc;{99}xyz[88]xyz(77)xyz;", s)
    }

    @Test fun testEscapeReplace() {
        val target: String
        val pattern: String
        var repl: String
        var s: String<|endoftext|>


Prompt:
class TestX : IFoo<X<String>> {
    override fun foo(): X<String> = X("O")
    override fun bar(): X<String> = X("K")
}

fun box(): String {
    val t: IFoo<X<String>> = TestX()
    val tFoo: Any = t.foo()
    if (tFoo !is X<*>) {

Response:
throw AssertionError("X expected: $tFoo")
    }

    return (t.foo() as X<*>).x.toString() + t.bar().x.toString()
}<|endoftext|>


Prompt:
internal val _delegate: ClassBuilder
    ) : DelegatingClassBuilder() {

        override fun getDelegate() = _delegate

        private lateinit var classInternalName: String

        private val signatures = MultiMap.createLinked<RawSignature, JvmDeclarationOrigin>()

Response:
override fun defineClass(origin: PsiElement?, version: Int, access: Int, name: String, signature: String?, superName: String, interfaces: Array<out String>) {
            classInternalName = name
            super.defineClass(origin, version, access, name, signature, superName, interfaces)
        }<|endoftext|>


Prompt: if (e != null || <!SENSELESS_COMPARISON!>this.e != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char & kotlin.Char?")!>this.e<!>.propNullableT

Response: if (e != null || <!SENSELESS_COMPARISON!>this.e != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char & kotlin.Char?")!>this.e<!>.propNullableAny<|endoftext|>


Prompt:
val moduleId = getUserVisibleModuleId(deserializer)
            if (moduleId in excludedModuleIds) return@mapNotNull null

            val module = ResolvedDependency(
                id = moduleId,
                // TODO: support extracting all the necessary details for non-Native libs: selectedVersion, requestedVersions, artifacts
                selectedVersion = ResolvedDependencyVersion.EMPTY,

Response:
// Assumption: As we don't know for sure which modules the source code module depends on directly and which modules
                // it depends on transitively, so let's assume it depends on all modules directly.
                requestedVersionsByIncomingDependencies = hashMapOf(
                    ResolvedDependencyId.DEFAULT_SOURCE_CODE_MODULE_ID to ResolvedDependencyVersion.EMPTY
                ),<|endoftext|>


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

import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor

Response:
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
import org.jetbrains.kotlin.psi.KtDeclaration<|endoftext|>


Prompt:
fun List<JsIrProgramFragment>.asTestFunctionContainers(): List<JsTestFunctionTransformer.TestFunctionContainer> {
    return mapNotNull { fragment ->
        fragment.testEnvironment?.let {
            JsTestFunctionTransformer.TestFunctionContainer(
                fragment.packageFqn,
                fragment.nameBindings.getTestFunctionBySignature(it.testFunctionTag),

Response:
fragment.nameBindings.getSuiteFunctionBySignature(it.suiteFunctionTag)
            )
        }
    }
}

fun CachedTestFunctionsWithTheirPackage.asTestFunctionContainers(
    suiteFunction: String?,
    nameBindings: Map<String, JsName>
): List<JsTestFunctionTransformer.TestFunctionContainer> {<|endoftext|>


Prompt:
private val annotationDiffs = ArrayList<NamedDiffEntry>()
    private val innerClassesDiffs = ArrayList<DiffEntry>()
    private val methodListDiffs = ArrayList<DiffEntry>()
    private val fieldListDiffs = ArrayList<DiffEntry>()
    private val metadataDiffs = ArrayList<DiffEntry>()

    private val methodReports = ArrayList<MethodReport>()

Response:
private val fieldReports = ArrayList<FieldReport>()

    private var classMetadataReport: ClassMetadataReport? = null
    private var fileFacadeMetadataReport: PackageMetadataReport? = null
    private var multiFileClassFacadeMetadataReport: MultiFileClassFacadeMetadataReport? = null
    private var multiFileClassPartMetadataReport: MultiFileClassPartMetadataReport? = null<|endoftext|>


Prompt:
@Test
    fun testClosingCache() {
        cache.close()

        assertTrue(cacheDir.resolve("java-cache.bin").exists())
        assertTrue(cacheDir.resolve("apt-cache.bin").exists())
    }

    @Test
    fun testMentionedTypes() {
        SourceFileStructure(File("Mentioned.java").toURI()).also {

Response:
it.addDeclaredType("test.Mentioned")
            cache.javaCache.addSourceStructure(it)
            compiledSources.single().resolve("test/Mentioned.class").createNewFile()
        }
        SourceFileStructure(File("Src.java").toURI()).also {
            it.addDeclaredType("test.Src")<|endoftext|>


Prompt:
if (project.kotlinNativeToolchainEnabled) {
            kotlinNativeBundleBuildService.get().prepareKotlinNativeBundle(
                project,
                kotlinNativeCompilerConfiguration,
                kotlinNativeVersion,
                bundleDir.asFile,
                reinstallFlag,
                konanTargets,
                overriddenKonanHome.orNull
            )
        }

Response:
kotlinNativeVersion
    }

    @get:Input
    val kotlinNativeDependencies: Provider<Set<String>> =
        kotlinNativeBundleVersion
            .zip(bundleDirectory) { _, bundleDir ->
                if (project.kotlinNativeToolchainEnabled && enableDependenciesDownloading) {
                    kotlinNativeBundleBuildService.get()<|endoftext|>


Prompt:
return !(this@case_6_2 !is Number || this@case_6_2 !is Int || <!SENSELESS_COMPARISON!>this@case_6_2 == null<!>)
}
inline fun <reified T : Any?> T?.case_6_3(): Boolean? {

Response: contract { returnsNotNull() implies (this@case_6_3 is Number && this@case_6_3 is Int && <!SENSELESS_COMPARISON!>this@case_6_3 != null<!>) }<|endoftext|>


Prompt:
if (DescriptorAsmUtil.getVisibilityAccessFlag(descriptor) == Opcodes.ACC_PRIVATE) return false

        if (!state.classBuilderMode.generateBodies) return true

        if (shouldGeneratePartHierarchy) {
            if (descriptor !is PropertyDescriptor || !descriptor.isConst) return false
        }

        return true

Response:
}

    private fun addDelegateGenerationTaskIfNeeded(callable: MemberDescriptor, task: () -> Unit) {
        if (shouldGenerateInFacade(callable)) {
            delegateGenerationTasks[callable] = task
        }
    }

    private fun generateDelegatesToPreviouslyCompiledParts() {
        if (compiledPackageFragment == null) return<|endoftext|>


Prompt:
baz(a, <!ARGUMENT_TYPE_MISMATCH!>1<!>)
            baz(a, w)
            baz(a, <!ARGUMENT_TYPE_MISMATCH!>""<!>)
        }
    }

Response:
<!INFERENCE_UNSUCCESSFUL_FORK, INFERENCE_UNSUCCESSFUL_FORK!>generate<!> {
        if (a is B) {
            baz(a, 1)
        }

        <!INFERENCE_UNSUCCESSFUL_FORK!>if (a is B) {<|endoftext|>


Prompt:
lhsIsNotNullNode.mergeIncomingFlow { path, flow ->
            getLhsVariable(path)?.let { flow.commitOperationStatement(it notEq null) }
        }
        rhsEnterNode.mergeIncomingFlow { path, flow ->
            getLhsVariable(path)?.let { flow.commitOperationStatement(it eq null) }
        }
    }

Response:
fun exitElvis(elvisExpression: FirElvisExpression, isLhsNotNull: Boolean, callCompleted: Boolean) {
        val node = graphBuilder.exitElvis(isLhsNotNull, callCompleted)
        node.mergeIncomingFlow { path, flow ->
            // If LHS is never null, then the edge from RHS is dead and this node's flow already contains<|endoftext|>


Prompt:
/**
 * Calculates the final element of a bounded arithmetic progression, i.e. the last element of the progression which is in the range
 * from [start] to [end] in case of a positive [step], or from [end] to [start] in case of a negative
 * [step].
 *
 * No validation on passed parameters is performed. The given parameters should satisfy the condition:
 *

Response:
* - either `step > 0` and `start <= end`,
 * - or `step < 0` and `start >= end`.
 *
 * @param start first element of the progression
 * @param end ending bound for the progression
 * @param step increment, or difference of successive elements in the progression
 * @return the final element of the progression
 * @suppress
 */
@PublishedApi<|endoftext|>


Prompt:
// TARGET_BACKEND: WASM

// RUN_THIRD_PARTY_OPTIMIZER
// WASM_DCE_EXPECTED_OUTPUT_SIZE: wasm 14_072
// WASM_DCE_EXPECTED_OUTPUT_SIZE:  mjs  5_170
// WASM_OPT_EXPECTED_OUTPUT_SIZE:       4_108

Response: fun box() = "OK"<|endoftext|>


Prompt:
throw RuntimeException(result)
        }

        a = suspendHere("cde")
        if (a != "cde#3") {
            result = "fail 2: $a"
            throw RuntimeException(result)
        }

        a = suspendHere(i = 6)
        if (a != "abc#7") {
            result = "fail 3: $a"
            throw RuntimeException(result)

Response:
}

        a = suspendHere("xyz", 9)
        if (a != "xyz#10") {
            result = "fail 4: $a"
            throw RuntimeException(result)
        }
    }

    return result
}<|endoftext|>


Prompt: val extension_generic_fun = fun<!TYPE_PARAMETERS_NOT_ALLOWED!><T><!><!UNRESOLVED_REFERENCE!>T<!>.(t: <!UNRESOLVED_REFERENCE!>T<!>): <!UNRESOLVED_REFERENCE!>T<!> = null!!

Response:
fun fun_with_where() = fun <!TYPE_PARAMETERS_NOT_ALLOWED!><T><!> <!UNRESOLVED_REFERENCE!>T<!>.(t: <!UNRESOLVED_REFERENCE!>T<!>): <!UNRESOLVED_REFERENCE!>T<!> where T: A = null!!

fun outer() {<|endoftext|>


Prompt:
override fun signature(index: Int): ByteArray = klib.signature(index, fileIndex)
    override fun string(index: Int): ByteArray = klib.string(index, fileIndex)
    override fun body(index: Int): ByteArray = klib.body(index, fileIndex)
    override fun debugInfo(index: Int): ByteArray? = klib.debugInfo(index, fileIndex)

Response:
}

fun IrLibraryFile.deserializeFqName(fqn: List<Int>): String =
    fqn.joinToString(".", transform = ::string)

fun IrLibraryFile.createFile(module: IrModuleFragment, fileProto: ProtoFile): IrFile {
    val fileName = fileProto.fileEntry.name<|endoftext|>


Prompt:
<!INAPPLICABLE_THREAD_LOCAL!>@ThreadLocal<!>
class Person1(val name: String) {
    var surname: String? = null
    <!INAPPLICABLE_THREAD_LOCAL_TOP_LEVEL!>@ThreadLocal<!>
    val extraInfo: Information = object : Information() {
        override var field: String = "extra info"
    }
}

Response:
@ThreadLocal
val extraInfo: Information = object : Information() {
    override var field: String = "extra info"
}

@ThreadLocal
val point1 = Point(1.0, 1.0)

<!INAPPLICABLE_THREAD_LOCAL!>@ThreadLocal<!>
val cornerPoint: Point
    get() = point1

@ThreadLocal<|endoftext|>


Prompt:
buildJdk = jdkVersion.location
        ) {
            build("assembleDebug")

            val modifiedSrc = subProject("app").kotlinSourcesDir().resolve("com/example/getSomething.kt")
            modifiedSrc.writeText(
                //language=kt
                """
                package com.example

                fun getSomething() = 10
                """.trimIndent()
            )

Response:
build("assembleDebug", buildOptions = buildOptions.copy(logLevel = LogLevel.DEBUG)) {
                val affectedKotlinFiles = listOf(
                    "app/src/main/kotlin/com/example/KotlinActivity1.kt",
                    "app/src/main/kotlin/com/example/getSomething.kt",
                )
                val affectedJavaFiles = listOf(<|endoftext|>


Prompt:
package org.jetbrains.kotlin.util

import org.jetbrains.kotlin.descriptors.DeclarationDescriptor

interface ModuleVisibilityHelper {
    fun isInFriendModule(what: DeclarationDescriptor, from: DeclarationDescriptor): Boolean

    object EMPTY: ModuleVisibilityHelper {

Response:
override fun isInFriendModule(what: DeclarationDescriptor, from: DeclarationDescriptor) = true
    }
}<|endoftext|>


Prompt:
* type-system, type-contexts-and-scopes, inner-and-nested-type-contexts -> paragraph 1 -> sentence 2
 * declarations, classifier-declaration, data-class-declaration -> paragraph 1 -> sentence 2
 * SECONDARY LINKS: declarations, classifier-declaration, class-declaration -> paragraph 2 -> sentence 2
 * NUMBER: 2

Response:
* DESCRIPTION: Primary constructor for nested class with regular constructor parameter
 */

// TESTCASE NUMBER: 1
data class A(<!DATA_CLASS_NOT_PROPERTY_PARAMETER!>x: Any?<!>)
data class B(<!DATA_CLASS_NOT_PROPERTY_PARAMETER!>x: Any<!>)<|endoftext|>


Prompt:
CompressedPointsToGraph(compressedEdges.toTypedArray()),
                        escapingNodes.toTypedArray()
                )
            }

            private fun buildDrains() {
                // TODO: This is actually conservative. If a field is being read of some node,
                // then here it is assumed that it might also be being read from any node reachable

Response:
// by assignment edges considering them undirected. But in reality it is enough to just
                // merge two sets: reachable by assignment edges and reachable by reversed assignment edges.
                // But, there will be a downside - drains will have to be created for each field access,
                // thus increasing the graph size significantly.
                val visited = mutableSetOf<PointsToGraphNode>()<|endoftext|>


Prompt:
private val loopInfo = Stack<LoopInfo>()
    private val blockScopes = Stack<BlockScope>()
    private val elementToLoopInfo = HashMap<KtLoopExpression, LoopInfo>()
    private val elementToSubroutineInfo = HashMap<KtElement, SubroutineInfo>()
    private var labelCount = 0

    private val builders = Stack<ControlFlowInstructionsGeneratorWorker>()

Response:
private val allBlocks = Stack<BlockInfo>()

    private fun pushBuilder(scopingElement: KtElement, subroutine: KtElement, shouldInline: Boolean) {
        val worker = ControlFlowInstructionsGeneratorWorker(scopingElement, subroutine, shouldInline)
        builders.push(worker)
        builder = worker
    }<|endoftext|>


Prompt:
// and the iterator's type parameter has enhanced nullability information (either explicit or implicit). Therefore we need
                // to traverse the initializer to find the `next()` or `componentN()` call. Example:
                //
                //   // In Java:
                //   public static Collection<@NotNull String> collection() { /* ... */ }
                //
                //   // In Kotlin:

Response:
//   for ((i, s) in JavaClass.collection().withIndex()) {
                //     println("$i: ${s.toUpperCase()}")   // NOTE: `s` is not nullable
                //   }
                //
                // The variable declaration for `s` looks like this:
                //<|endoftext|>


Prompt:
3017, 3018, 3019, 3020, 3021, 3022, 3023, 3024, 3025, 3026, 3027, 3028, 3029, 3030, 3031, 3032,
    3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048,

Response:
3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064,
    3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080,<|endoftext|>


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

/*
 * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
 *

Response:
* SPEC VERSION: 0.1-280
 * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-with-named-parameters -> paragraph 1 -> sentence 2
 * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-with-named-parameters -> paragraph 2 -> sentence 1
 * NUMBER: 2<|endoftext|>


Prompt:
// cache[resourceId] ?: findViewById(resourceId)?.also { cache[resourceId] = it }
                    +irReturn(irElvis(returnType, irCallOp(mapGet.symbol, returnType, irGet(cache), irGet(resourceId))) {
                        irSafeLet(returnType, irFindViewById(irGet(self), irGet(resourceId), containerType)) { foundView ->

Response:
irBlock {
                                +irCall(mapSet.symbol).apply {
                                    dispatchReceiver = irGet(cache)
                                    putValueArgument(0, irGet(resourceId))
                                    putValueArgument(1, irGet(foundView))
                                }
                                +irGet(foundView)
                            }
                        }
                    })
                }
            }
        }<|endoftext|>


Prompt:
deserializeCompositeBlock(proto.compositeBlock)
        }

        JsAstProtoBuf.Statement.StatementCase.LABEL -> {
            val labelProto = proto.label
            JsLabel(deserializeName(labelProto.nameId), deserialize(labelProto.innerStatement))
        }

Response:
JsAstProtoBuf.Statement.StatementCase.IF_STATEMENT -> {
            val ifProto = proto.ifStatement
            JsIf(
                deserialize(ifProto.condition),
                deserialize(ifProto.thenStatement),
                if (ifProto.hasElseStatement()) deserialize(ifProto.elseStatement) else null
            )
        }<|endoftext|>


Prompt:
val wrapper = inputStream.decodingWith(Base64)

        wrapper.use {
            assertEquals('f'.code, it.read())
            assertEquals(-1, it.read())
            assertEquals(-1, it.read())

            // in the wrapped IS the chars after the padding are not consumed
            assertContentEquals("Zg==".toByteArray(), inputStream.readBytes())
        }

Response:
assertFailsWith<IOException> {
            wrapper.read()
        }
    }

    @Test
    fun correctPaddingMime() {
        val inputStream = "Zg==Zg==".byteInputStream()
        val wrapper = inputStream.decodingWith(Base64.Mime)

        wrapper.use {
            assertEquals('f'.code, it.read())<|endoftext|>


Prompt:
createClassTypeRefWithSourceKind: (KtFakeSourceElementKind) -> FirTypeRef,
    createParameterTypeRefWithSourceKind: (FirProperty, KtFakeSourceElementKind) -> FirTypeRef,
    toFirSource: (TBase?, KtFakeSourceElementKind) -> KtSourceElement?,
    addValueParameterAnnotations: FirValueParameterBuilder.(TParameter) -> Unit,

Response:
isVararg: (TParameter) -> Boolean,
): FirSimpleFunction {
    fun generateComponentAccess(
        parameterSource: KtSourceElement?,
        firProperty: FirProperty,
        classTypeRefWithCorrectSourceKind: FirTypeRef,
        firPropertyReturnTypeRefWithCorrectSourceKind: FirTypeRef,
    ) =
        buildPropertyAccessExpression {
            this.source = parameterSource<|endoftext|>


Prompt:
}
                        else -> FirErrors.USAGE_IS_NOT_INLINABLE
                    }
                    reporter.reportOn(argument.source, factory, valueParameterOfOriginalInlineFunction, context)
                }
            }
        }

        private fun checkReceiver(
            qualifiedAccessExpression: FirQualifiedAccessExpression,
            receiverExpression: FirExpression?,

Response:
targetSymbol: FirBasedSymbol<*>?,
            context: CheckerContext,
            reporter: DiagnosticReporter,
        ) {
            if (receiverExpression == null) return
            val receiverSymbol =
                receiverExpression.unwrapErrorExpression()?.toResolvedCallableSymbol(session) as? FirValueParameterSymbol ?: return<|endoftext|>


Prompt:
// FIR_IDENTICAL
open class A
open class B: A()

open class Base<out T>
class SubBase: Base<B>()

// f is SubBase => (SubBase <: Base<B>) f is Base<B> => (B <: A, Base<Covariant T> => SubBase <: Base<A>) f is Base<A>

Response: fun test(f: SubBase) = <!USELESS_IS_CHECK!>f is Base<A><!><|endoftext|>


Prompt:
* The operation is _intermediate_ and _stateful_.
 *
 * @sample samples.collections.Collections.Sorting.sortedBy
 */
public inline fun <T, R : Comparable<R>> Sequence<T>.sortedBy(crossinline selector: (T) -> R?): Sequence<T> {
    return sortedWith(compareBy(selector))
}

/**

Response:
* Returns a sequence that yields elements of this sequence sorted descending according to natural sort order of the value returned by specified [selector] function.
 *
 * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.
 *
 * The operation is _intermediate_ and _stateful_.
 */<|endoftext|>


Prompt:
for (statement in expression.statements.subListWithoutLast(if (resultIsUsed) 1 else 0)) {
                    val call = getFunctionCallOrNull(statement) ?: continue
                    val node = replacements.getRootMfvcNodeOrNull(call.type.erasedUpperBound) ?: continue
                    if (node.boxMethod == call.symbol.owner &&

Response:
List(call.valueArgumentsCount) { call.getValueArgument(it) }.all { it.isRepeatableGetter() }
                    ) {
                        statementsToRemove.add(statement)
                    }
                }
                expression.statements.removeIf { it in statementsToRemove }
            }
        }, false)
    }
}<|endoftext|>


Prompt:
}
        }

        for (file in sourceFiles) {
            val fileTranslationData = serializer.translationData(file)

            val packagePart =
                serializeScope(bindingTrace.bindingContext, moduleDescriptor, file.packageFqName, fileTranslationData.memberScope)

            val ioFile = VfsUtilCore.virtualToIoFile(file.virtualFile)

Response:
incrementalResults?.processPackagePart(
                ioFile,
                packagePart.toByteArray(),
                fileTranslationData.binaryAst ?: ByteArray(0),
                fileTranslationData.inlineData ?: ByteArray(0)
            )
        }

        val settings = config.configuration.languageVersionSettings<|endoftext|>


Prompt:
else -> defaultType
        }
    }

    private fun convert(typeReference: KtTypeReference?, substitutions: SubstitutionMap): JCTree.JCExpression {
        val type = typeReference?.typeElement ?: return defaultType
        return convert(type, substitutions)
    }

    private fun convert(type: SimpleType): JCTree.JCExpression {

Response:
// TODO now the raw Java type is returned. In future we need to properly convert all type parameters
        return treeMaker.Type(KaptTypeMapper.mapType(type))
    }

    private fun convertUserType(type: KtUserType, substitutions: SubstitutionMap): JCTree.JCExpression {<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_PARAMETER

fun takeFnToAny(fn: () -> Any) {}
fun takeFnToUnit(fn: () -> Unit) {}
fun <P> takeFnToParameter(fn: () -> P) {}

fun testAny() {
    takeFnToAny {  }
    takeFnToAny { Unit }

Response:
takeFnToAny { <!UNRESOLVED_REFERENCE!>unresolved<!>() }
    takeFnToAny { if (true) <!UNRESOLVED_REFERENCE!>unresolved<!>() }<|endoftext|>


Prompt:
TypeUtils.createSubstitutedSupertype(this, it, TypeSubstitutor.create(this))
    }
}

fun KotlinType.asTypeProjection(): TypeProjection = TypeProjectionImpl(this)
fun KotlinType.contains(predicate: (UnwrappedType) -> Boolean) = TypeUtils.contains(this, predicate)

Response:
fun KotlinType.replaceArgumentsWithStarProjections() = replaceArgumentsByParametersWith(::StarProjectionImpl)
fun KotlinType.replaceArgumentsWithNothing() = replaceArgumentsByParametersWith { it.builtIns.nothingType.asTypeProjection() }<|endoftext|>


Prompt:
override fun visitBreak(x: JsBreak) { }

        override fun visitContinue(x: JsContinue) { }

        override fun visit(x: JsVars.JsVar) {
            val initializer = x.initExpression
            if (initializer != null) {
                accept(initializer)
            }
        }

Response:
override fun visitNameRef(nameRef: JsNameRef) {
            super.visitNameRef(nameRef)
            val name = nameRef.name
            if (name != null && nameRef.qualifier == null) {
                references.add(name)
            }
        }

        override fun visitFunction(x: JsFunction) {
            references += x.collectFreeVariables()<|endoftext|>


Prompt:
list1.add(i)
        if (list1.size > 23) break
    }
    if (list1 != listOf<UInt>(3u, 4u, 5u)) {
        return "Wrong elements for (1u + 2u)..(6u - 1u): $list1"
    }

    val list2 = ArrayList<UInt>()

Response:
val range2 = (1u.toUByte() + 2u.toUByte()).toUByte()..(6u.toUByte() - 1u.toUByte()).toUByte()
    for (i in range2) {
        list2.add(i)
        if (list2.size > 23) break
    }<|endoftext|>


Prompt:
context.symbolTable.descriptorExtension.referenceClass(context.getJsInternalClass("JsImplicitExport"))

    // TODO move CharSequence-related stiff to IntrinsifyCallsLowering
    val charSequenceClassSymbol = context.symbolTable.descriptorExtension.referenceClass(context.getClass(FqName("kotlin.CharSequence")))

Response:
val charSequenceLengthPropertyGetterSymbol by context.lazy2 {
        with(charSequenceClassSymbol.owner.declarations) {
            filterIsInstance<IrProperty>().firstOrNull { it.name.asString() == "length" }?.getter ?:
            filterIsInstance<IrFunction>().first { it.name.asString() == "<get-length>" }
        }.symbol<|endoftext|>


Prompt:
return directExpansionType.fullyExpandedType(useSiteSession, expandedConeType)
}

fun ConeClassLikeType.directExpansionType(
    useSiteSession: FirSession,
    expandedConeType: (FirTypeAlias) -> ConeClassLikeType? = { alias ->
        alias.lazyResolveToPhase(FirResolvePhase.SUPER_TYPES)

Response:
alias.expandedConeType
    },
): ConeClassLikeType? {
    if (this is ConeErrorType) return null
    val typeAliasSymbol = lookupTag.toSymbol(useSiteSession) as? FirTypeAliasSymbol ?: return null
    val typeAlias = typeAliasSymbol.fir

    val resultType = expandedConeType(typeAlias)<|endoftext|>


Prompt:
requireNotNull(atomicProperty.backingField) { "The backing field of the atomic array [${atomicProperty.atomicfuRender()}] should not be null." + CONSTRAINTS_MESSAGE }
            val initializer = atomicArrayField.initializer?.expression
            if (initializer == null) {
                // replace field initialization in the init block

Response:
val initBlock = atomicArrayField.getInitBlockForField(parentContainer)
                // property initialization order in the init block matters -> transformed initializer should be placed at the same position
                val initExprWithIndex = initBlock.getInitExprWithIndexFromInitBlock(atomicArrayField.symbol)<|endoftext|>


Prompt:
BindingUtils.getClassDescriptor(context.bindingContext(), classDeclaration)

    private val delegationBySpecifiers =
            classDeclaration.superTypeListEntries.filterIsInstance<KtDelegatedSuperTypeEntry>()

    private class Field (val name: JsName, val generateField: Boolean)

Response:
private val fields = mutableMapOf<KtDelegatedSuperTypeEntry, Field>()

    init {
        for (specifier in delegationBySpecifiers) {
            val expression = specifier.delegateExpression ?:
                             throw IllegalArgumentException("delegate expression should not be null: ${specifier.text}")<|endoftext|>


Prompt:
if (!(0.toByte() in 3..<1) != !range1.contains(0.toByte())) throw AssertionError()
    if (!(0.toByte() !in 3..<1) != range1.contains(0.toByte())) throw AssertionError()
    // no local optimizations

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


Prompt:
privateVarTopLevel = 1

        publishedVar
        publishedVar = 1
    }

    @PublishedApi
    internal inline fun testInline() {
        publicFun()
        <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>internalFun<!>()

Response:
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>privateFun<!>()

        publicVarTopLevel
        publicVarTopLevel = 1
        <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>internalVarTopLevel<!><|endoftext|>


Prompt:
A(169), A(170), A(171), A(172), A(173), A(174), A(175), A(176), A(177), A(178), A(179), A(180),
        A(181), A(182), A(183), A(184), A(185), A(186), A(187), A(188), A(189), A(190), A(191), A(192),

Response:
A(193), A(194), A(195), A(196), A(197), A(198), A(199), A(200), A(201), A(202), A(203), A(204),
        A(205), A(206), A(207), A(208), A(209), A(210), A(211), A(212), A(213), A(214), A(215), A(216),<|endoftext|>


Prompt:
fun bar(s: S?) = when (s) {
    is Derived -> "Derived"
    null -> ""
    else -> TODO("What?!?!")
}

fun baz(b: Boolean?) = when (b) {
    true -> 1
    false -> 0
    null -> -1
    // Still warning
    else -> TODO()
}

Response:
fun baz(b: Boolean) = when (b) {
    true -> 1
    false -> 0
    // Still warning
    else -> TODO()
}<|endoftext|>


Prompt:
import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticsHandler
import org.jetbrains.kotlin.test.frontend.classic.handlers.OldNewInferenceMetaInfoProcessor
import org.jetbrains.kotlin.test.model.DependencyKind
import org.jetbrains.kotlin.test.model.FrontendKinds

Response:
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
import org.jetbrains.kotlin.test.services.AbstractEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.LibraryProvider
import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator<|endoftext|>


Prompt:
* @param cacheDir - the directory where the incremental cache updater will store its caches. [CacheUpdater] maintains the directory fully.
 * @param compilerInterfaceFactory - is a factory that creates an instance of the compiler used for building dirty files.
 *
 * The main public methods are:
 *  [actualizeCaches] - performs the entire incremental compilation routine;

Response:
*  [getDirtyFileLastStats] - retrieves stats about dirty files, explaining why the file has been marked as dirty (see [DirtyFileState]);
 *  [getStopwatchLastLaps] - retrieves the durations of the incremental compilation subroutines;
 *
 *  For a better understanding of what happens here, pay attention to [stopwatch] usages.<|endoftext|>


Prompt:
fun reportElement() = annotationEntry.typeArguments.singleOrNull() ?: annotationEntry

        if (parcelerClass.kind != ClassKind.OBJECT) {
            context.trace.report(ErrorsAndroid.PARCELER_SHOULD_BE_OBJECT.on(reportElement()))
            return
        }

Response:
fun KotlinType.fqName() = constructor.declarationDescriptor?.fqNameSafe
        val parcelerSuperType = parcelerClass.defaultType.supertypes().firstOrNull { it.fqName() == PARCELER_FQNAME } ?: return
        val expectedType = parcelerSuperType.arguments.singleOrNull()?.type ?: return<|endoftext|>


Prompt:
includedLibraryDescriptors: List<ModuleDescriptor>,
        exportedDependencies: List<ModuleDescriptor>,
    ): FqName {
        // Consider exported libraries only if we cannot infer the package from sources or included libs.
        return guessMainPackage(includedLibraryDescriptors + moduleDescriptor)
            ?: guessMainPackage(exportedDependencies)
            ?: FqName.ROOT

Response:
}

    private fun guessMainPackage(modules: List<ModuleDescriptor>): FqName? {
        if (modules.isEmpty()) {
            return null
        }

        val allPackages = modules.flatMap {
            it.getPackageFragments() // Includes also all parent packages, e.g. the root one.
        }

        val nonEmptyPackages = allPackages<|endoftext|>


Prompt:
val deserializeOverridden = classDescriptor.unsubstitutedMemberScope
            .getContributedFunctions(LOAD_NAME, NoLookupLocation.FROM_BACKEND).singleOrNull {
                it.valueParameters.size == 1
                        && it.overriddenDescriptors.isNotEmpty()
                        && it.kind != CallableMemberDescriptor.Kind.SYNTHESIZED

Response:
} != null

        if (descriptorOverridden && serializeOverridden && deserializeOverridden) {
            val entry = classDescriptor.findAnnotationDeclaration(SerializationAnnotations.serializerAnnotationFqName)
            trace.report(EXTERNAL_SERIALIZER_USELESS.on(entry ?: declaration, classDescriptor.defaultType))
            return
        }<|endoftext|>


Prompt:
}

    companion object {
        fun from(pattern: MappingPattern, charCode: Int, categoryCode: String, mapping: Int): LuLtLlMappingPattern? {
            if (pattern is EqualDistanceMappingPattern
                && pattern.length == 1
                && pattern.categoryCode == "Lu"
                && pattern.mapping == 1
            ) {

Response:
val newPattern = LuLtLlMappingPattern(pattern.start, pattern.categoryCode, pattern.mapping)
                if (newPattern.append(charCode, categoryCode, mapping)) {
                    return newPattern
                }
            }
            return null
        }
    }
}<|endoftext|>


Prompt:
}
    }

    @GradleTestVersions(minVersion = TestVersions.Gradle.G_7_6)
    @GradleTest
    fun `test dependency on java testFixtures and feature source sets`(gradleVersion: GradleVersion) {
        project(
            "kt-60053-dependencyOn-testFixtures",
            gradleVersion,

Response:
localRepoDir = defaultLocalRepo(gradleVersion)
        ) {
            build("publish")

            resolveIdeDependencies(":consumer") { dependencies ->
                val jvmMainDependencies = dependencies["jvmMain"].filterIsInstance<IdeaKotlinBinaryDependency>().assertMatches(
                    kotlinStdlibDependencies,<|endoftext|>


Prompt:
val substitutedLambdaTypes = substituteFunctionLiteralDescriptor(lambda, descriptor, resultSubstitutor)

        val existingLambdaType = topLevelTrace.getType(ktArgumentExpression)

        if (existingLambdaType == null) {
            if (ktFunction is KtNamedFunction && ktFunction.nameIdentifier != null) return // it's a statement

Response:
throw AssertionError("No type for resolved lambda argument: ${ktArgumentExpression.text}")
        }

        val substitutedFunctionalType = createFunctionType(
            builtIns,
            existingLambdaType.annotations,
            substitutedLambdaTypes.receiverType?.substitutedType,<|endoftext|>


Prompt:
val list1 = ArrayList<Int>()
    for (i in (MaxI - 5)..MaxI step 3) {
        list1.add(i)
        if (list1.size > 23) break
    }
    if (list1 != listOf<Int>(MaxI - 5, MaxI - 2)) {

Response:
return "Wrong elements for (MaxI - 5)..MaxI step 3: $list1"
    }

    val list2 = ArrayList<Int>()
    for (i in (MaxB - 5).toByte()..MaxB step 3) {
        list2.add(i)
        if (list2.size > 23) break
    }<|endoftext|>


Prompt:
noArgs <!TOO_MANY_ARGUMENTS!>{}<!>
    noArgs() <!TOO_MANY_ARGUMENTS!>{}<!>
    noArgs() // {}
    noArgs() /* */ <!TOO_MANY_ARGUMENTS!>{}<!>
    noArgs() /*
        block comment, no new line

Response:
*/ <!TOO_MANY_ARGUMENTS!>{}<!>
    noArgs()
    /*
        block comment with new line
    */
    <!TOO_MANY_ARGUMENTS!>{}<!>
    noArgs() // comment
    // comment
    <!TOO_MANY_ARGUMENTS!>{}<!><|endoftext|>


Prompt:
ll.last
    ll.last()
    ll.<!DEBUG_INFO_CALL("fqName: java.util.LinkedList.removeFirst; typeCall: function")!>removeFirst()<!>
    ll.<!DEBUG_INFO_CALL("fqName: java.util.LinkedList.removeLast; typeCall: function")!>removeLast()<!>

Response:
ll.<!DEBUG_INFO_CALL("fqName: kotlin.collections.reversed; typeCall: extension function")!>reversed()<!>

    al.addFirst("")
    al.addLast("")
    al.getFirst()
    al.first
    al.first()
    al.getLast()
    al.last
    al.last()<|endoftext|>


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

import org.jetbrains.kotlin.konan.test.blackbox.support.ClassLevelProperty
import org.jetbrains.kotlin.konan.test.blackbox.support.EnforcedProperty

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


Prompt:
recapturedParamInfo.functionalArgument = NonInlineArgumentForInlineSuspendParameter.INLINE_LAMBDA_AS_VARIABLE
                    }
                    capturedParamBuilder.addCapturedParam(recapturedParamInfo, recapturedParamInfo.newFieldName).remapValue =

Response:
StackValue.field(desc.type, oldObjectType, recapturedParamInfo.newFieldName, false, StackValue.LOCAL_0)
                    allRecapturedParameters.add(desc)
                }
            }
        } else if (capturedLambdas.isNotEmpty()) {<|endoftext|>


Prompt:
final override fun visitEffectDeclaration(effectDeclaration: FirEffectDeclaration, data: D): FirContractElementDeclaration {
        return transformEffectDeclaration(effectDeclaration, data)
    }

    open fun transformContractDescription(contractDescription: FirContractDescription, data: D): FirContractDescription {
        return transformElement(contractDescription, data)
    }

Response:
final override fun visitContractDescription(contractDescription: FirContractDescription, data: D): FirContractDescription {
        return transformContractDescription(contractDescription, data)
    }

    open fun transformLegacyRawContractDescription(legacyRawContractDescription: FirLegacyRawContractDescription, data: D): FirContractDescription {
        return transformElement(legacyRawContractDescription, data)
    }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProviderInternals
import org.jetbrains.kotlin.fir.scopes.FirKotlinScopeProvider
import org.jetbrains.kotlin.fir.symbols.impl.*
import org.jetbrains.kotlin.fir.types.ConeTypeProjection

Response:
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
import org.jetbrains.kotlin.fir.types.constructClassType
import org.jetbrains.kotlin.fir.types.toLookupTag
import org.jetbrains.kotlin.library.KotlinLibrary<|endoftext|>


Prompt:
expectFailure(linkage("Constructor 'AnnotationClassWithChangedParameterType.<init>' can not be called: No constructor found for symbol '/AnnotationClassWithChangedParameterType.<init>'")) { getAnnotationClassWithChangedParameterTypeAsAnyInline() }
    expectSuccess(105) { getAnnotationClassThatBecomesRegularClass().x }

Response:
expectSuccess(106) { getAnnotationClassThatBecomesRegularClassInline().x }
    expectSuccess("AnnotationClassThatBecomesRegularClass[x=107]") { getAnnotationClassThatBecomesRegularClassAsAny().toString() }
    expectSuccess("AnnotationClassThatBecomesRegularClass[x=108]") { getAnnotationClassThatBecomesRegularClassAsAnyInline().toString() }<|endoftext|>


Prompt:
/**
     * Converts this [Float] value to [Int].
     *
     * The fractional part, if any, is rounded down towards zero.
     * Returns zero if this `Float` value is `NaN`, [Int.MIN_VALUE] if it's less than `Int.MIN_VALUE`,
     * [Int.MAX_VALUE] if it's bigger than `Int.MAX_VALUE`.
     */

Response:
@kotlin.internal.IntrinsicConstEvaluation
    public override fun toInt(): Int =
        wasm_i32_trunc_sat_f32_s(this)

    /**
     * Converts this [Float] value to [Long].
     *
     * The fractional part, if any, is rounded down towards zero.<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString? & kotlin.String")!>x<!>.propNullableT
                        <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString? & kotlin.String")!>x<!>.propNullableAny

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString? & kotlin.String")!>x<!>.funT()
                        <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString? & kotlin.String")!>x<!>.funAny()<|endoftext|>


Prompt:
},

    E4 {
        fun c() {
            this.B()

            C.A()
            A()
            //TODO: should be resolved with error
            this.<!UNRESOLVED_REFERENCE!>A<!>()
        }
    };

    class A
    inner class B
    object O {
        object InO
    }
}

Response:
fun f() {
    C.E1.<!UNRESOLVED_REFERENCE!>A<!>
    C.E1.<!UNRESOLVED_REFERENCE!>A<!>()
    C.E2.B()

    C.E2.<!UNRESOLVED_REFERENCE!>O<!><|endoftext|>


Prompt:
val dependencySrcMetadata = dependencyCache.fetchSourceFileFullMetadata(dependencySrcFile)
                    val oldSignatures = dependencySrcMetadata.inverseDependencies[libFile, srcFile] ?: emptySet()
                    if (oldSignatures == newSignatures) {
                        continue
                    }

Response:
val newMetadata = addNewMetadata(dependencyLibFile, dependencySrcFile, dependencySrcMetadata)
                    newMetadata.inverseDependencies[libFile, srcFile] = newSignatures.keys
                }
            }
        }

        private fun KotlinSourceFileMutableMap<UpdatedDependenciesMetadata>.addDependenciesWithRemovedInverseDependencies(<|endoftext|>


Prompt:
package kotlin.coroutines

/**
 * Marks coroutine context element that intercepts coroutine continuations.
 * The coroutines framework uses [ContinuationInterceptor.Key] to retrieve the interceptor and
 * intercepts all coroutine continuations with [interceptContinuation] invocations.
 *
 * [ContinuationInterceptor] behaves like a [polymorphic element][AbstractCoroutineContextKey], meaning that

Response:
* its implementation delegates [get][CoroutineContext.Element.get] and [minusKey][CoroutineContext.Element.minusKey]
 * to [getPolymorphicElement] and [minusPolymorphicKey] respectively.
 * [ContinuationInterceptor] subtypes can be extracted from the coroutine context using either [ContinuationInterceptor.Key]
 * or subtype key if it extends [AbstractCoroutineContextKey].
 */<|endoftext|>


Prompt:
import kotlin.script.experimental.host.ScriptingHostConfiguration

class ScriptingCompilerConfigurationExtension(
    val project: MockProject,
    val baseHostConfiguration: ScriptingHostConfiguration
) : CompilerConfigurationExtension {

    override fun updateConfiguration(configuration: CompilerConfiguration) {

Response:
if (!configuration.getBoolean(ScriptingConfigurationKeys.DISABLE_SCRIPTING_PLUGIN_OPTION)) {

            val projectRoot = project.run { basePath ?: baseDir?.canonicalPath }?.let(::File)
            if (projectRoot != null) {
                configuration.put(<|endoftext|>


Prompt:
* @param V the type of map values. The map is covariant in its value type.
 */
public interface Map<K, out V> {
    // Query Operations
    /**
     * Returns the number of key/value pairs in the map.
     */
    public val size: Int

    /**
     * Returns `true` if the map is empty (contains no elements), `false` otherwise.
     */

Response:
public fun isEmpty(): Boolean

    /**
     * Returns `true` if the map contains the specified [key].
     */
    public fun containsKey(key: K): Boolean

    /**
     * Returns `true` if the map maps one or more keys to the specified [value].
     */
    public fun containsValue(value: @UnsafeVariance V): Boolean

    /**<|endoftext|>


Prompt:
// the user is required to provide an explicit override of such a property in a non-abstract subclass.
        // See: compiler/testData/diagnostics/tests/varOverriddenByValThroughIntersection.kt.
        val key = mostSpecific.find { it is FirPropertySymbol && it.isVar } as? S ?: mostSpecific.first() as S
        val keyFir = key.fir

Response:
val callableId = CallableId(dispatchReceiverType.classId ?: keyFir.dispatchReceiverClassLookupTagOrNull()?.classId!!, keyFir.name)
        val newSymbol = createIntersectionOverrideSymbol(callableId, overrides, containsMultipleNonSubsumed)
        val deferredReturnTypeCalculation = deferredReturnTypeCalculationOrNull(mostSpecific)<|endoftext|>


Prompt:
fun poll74(): Flow<String> {
    return flow {
        val inv = ::bar5<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
        inv
    }
}

fun poll75(): Flow<String> {
    return flow {

Response:
val inv = ::Foo6<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
        inv
    }
}

fun poll76(): Flow<String> {
    return flow {<|endoftext|>


Prompt:
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments =
        K2JSCompilerArguments().apply {
            libraries = "build/js-ir-runtime/full-runtime.klib"
            outputDir = destinationDir.path
            moduleName = testDir.name
            sourceMap = false
            irProduceKlibDir = false

Response:
irProduceKlibFile = true
            irOnly = true
            languageVersion = "1.9"
        }

    override val buildLogFinder: BuildLogFinder
        get() = super.buildLogFinder.copy(
            isFirEnabled = false,
            isKlibEnabled = true,
            isJsEnabled = true,<|endoftext|>


Prompt:
return obj1 === obj2 && (obj1 !== 0 || 1.asDynamic() / obj1 === 1.asDynamic() / obj2)
    }
    return obj1 === obj2
}

internal fun toString(o: dynamic): String = when {
    o == null -> "null"
    isArrayish(o) -> "[...]"

Response:
jsTypeOf(o.toString) != "function" -> anyToString(o)
    else -> (o.toString)().unsafeCast<String>()
}

internal fun anyToString(o: dynamic): String = js("Object").prototype.toString.call(o)

internal fun hashCode(obj: dynamic): Int {
    if (obj == null) return 0<|endoftext|>


Prompt:
open var onupdatefound: ((Event) -> Unit)?
    open val APISpace: JsAny?
    fun update(): Promise<Nothing?>
    fun unregister(): Promise<JsBoolean>
    fun showNotification(title: String, options: NotificationOptions = definedExternally): Promise<Nothing?>
    fun getNotifications(filter: GetNotificationOptions = definedExternally): Promise<JsArray<Notification>>

Response:
fun methodName(): Promise<JsAny?>
}

/**
 * Exposes the JavaScript [ServiceWorkerContainer](https://developer.mozilla.org/en/docs/Web/API/ServiceWorkerContainer) to Kotlin
 */
public external abstract class ServiceWorkerContainer : EventTarget, JsAny {
    open val controller: ServiceWorker?
    open val ready: Promise<ServiceWorkerRegistration><|endoftext|>


Prompt:
|For the Cinterop task, either the `definitionFile` or `packageName` parameter must be specified, however, neither has been provided.
                    |
                    |More info here: https://kotlinlang.org/docs/multiplatform-dsl-reference.html#cinterops
                    """.trimMargin()
                )
            }
        }
    }

Response:
@DisplayName("KT-62800: check that optional .def file in cinterop works well with configuration cache")
    @GradleTestVersions(minVersion = TestVersions.Gradle.G_8_1) // Gradle supports checking file existence with configuration cache only since 8.1 version
    @GradleTest
    fun cinteropWithOptionalDefFileAndConfigurationCache(gradleVersion: GradleVersion) {
        nativeProject(<|endoftext|>


Prompt:
import org.jetbrains.kotlin.gradle.utils.*
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
import org.jetbrains.kotlin.gradle.utils.named
import org.jetbrains.kotlin.gradle.utils.newInstance

/**

Response:
* Creates an adhoc/external Kotlin Target which can be maintained and evolved outside the kotlin.git repository.
 * The target will be created adhering to the configuration provided by the [descriptor].
 * The instance will be backed by an internal implementation of [KotlinTarget]
 * The instance will be created using the [ExternalKotlinTargetDescriptor.targetFactory] which will have to inject the backing<|endoftext|>


Prompt:
@DisplayName("UTD with adding and removing target")
    @GradleTest
    fun testUTDTargetAdded(gradleVersion: GradleVersion) {
        nativeProjectWithCocoapodsAndIosAppPodFile(gradleVersion = gradleVersion) {
            buildGradleKts.addPod(defaultPodName, produceGitBlock())

            testImport()

Response:
buildGradleKts.addCocoapodsBlock("osx.deploymentTarget = \"10.15\"")
            testImport()

            val tasks = listOf(
                podspecTaskName,
                defaultPodGenTaskName,
                defaultSetupBuildTaskName,
                defaultBuildTaskName,
                defaultCinteropTaskName
            )
            val anotherTarget = "MacosX64"<|endoftext|>


Prompt:
* [destination] should be either a path to the directory under [tmpdir], or a path to the resulting .jar file (also under [tmpdir]).
     * Kotlin sources are compiled first, and there should be no errors or warnings. Java sources are compiled next.
     *
     * @return [destination]
     */
    protected fun compileLibrary(
        libraryName: String,

Response:
destination: File = File(tmpdir, "$libraryName.jar"),
        additionalOptions: List<String> = emptyList(),
        compileJava: (sourceDir: File, javaFiles: List<File>, outputDir: File) -> Boolean = { _, javaFiles, outputDir ->
            KotlinTestUtils.compileJavaFiles(javaFiles, listOf("-d", outputDir.path))
        },<|endoftext|>


Prompt:
// EXPECTED_REACHABLE_NODES: 1287
package foo

val r = "OK"

fun simple(s: String? = null): String {
    if (s != null) return s

    return myRun {
        simple("OK")
    }
}

val ok = "OK"
fun withClosure(s: String? = null): String {
    if (s != null) return s

Response:
return ok + myRun {
        withClosure(ok)
    }
}

fun box(): String {
    if (simple("OK") != "OK") return "failed on simple recursion"

    if (withClosure() != ok + ok) return "failed when closure something"

    return "OK"
}<|endoftext|>


Prompt:
if (isFunction) append("(")
                    parameterTypes.withIndex().drop(1).joinTo(this) { (index, type) ->
                        castValue(('a' + index).toString(), type)
                    }
                    if (isFunction) append(")")
                }
            }
        }

    private fun getIrMethodSymbolByName(methodName: String): String? {

Response:
return when (methodName) {
            BuiltInOperatorNames.LESS -> "<"
            BuiltInOperatorNames.LESS_OR_EQUAL -> "<="
            BuiltInOperatorNames.GREATER -> ">"
            BuiltInOperatorNames.GREATER_OR_EQUAL -> ">="
            BuiltInOperatorNames.EQEQ -> "=="<|endoftext|>


Prompt:
if (this != null) {
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>this<!>
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>this<!>.inv()
        }
    }

    x[0].also {

Response:
if (it != null) {
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>it<!>
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>it<!>.inv()
        }
    }
}

// TESTCASE NUMBER: 3<|endoftext|>


Prompt:
/** Divides this value by the other value, truncating the result to an integer that is closer to zero. */
    @kotlin.internal.IntrinsicConstEvaluation
    public inline operator fun div(other: Int): Int =
        this.toInt() / other

    /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */

Response:
@kotlin.internal.IntrinsicConstEvaluation
    public inline operator fun div(other: Long): Long =
        this.toLong() / other

    /** Divides this value by the other value. */
    @kotlin.internal.IntrinsicConstEvaluation
    public inline operator fun div(other: Float): Float =
        this.toFloat() / other<|endoftext|>


Prompt:
regularNestedClassifierScope: FirNestedClassifierScope?,
        ): FirGeneratedClassNestedClassifierScope? {
            /*
             * Extensions can modify source classes of the same session in which they are enabled
             * This implies the contract that if declaration-site session and use-site session
             *   differs for some class, generated declarations should be provided by extensions
             *   of declaration-site session
             */

Response:
val storage = classSymbol.moduleData
                .session
                .generatedDeclarationsStorage
                .getClassifierStorage(classSymbol, regularNestedClassifierScope)
                ?: return null

            return FirGeneratedClassNestedClassifierScope(useSiteSession, classSymbol.fir, storage,)
        }
    }<|endoftext|>


Prompt:
return "Wrong elements for 3u.toUByte()..9u.toUByte() step 2: $list2"
    }

    val list3 = ArrayList<UInt>()
    val range3 = 3u.toUShort()..9u.toUShort() step 2
    for (i in range3) {
        list3.add(i)

Response:
if (list3.size > 23) break
    }
    if (list3 != listOf<UInt>(3u, 5u, 7u, 9u)) {
        return "Wrong elements for 3u.toUShort()..9u.toUShort() step 2: $list3"
    }

    val list4 = ArrayList<ULong>()<|endoftext|>


Prompt:
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.asTypeProjection
import org.jetbrains.kotlin.types.typeUtil.isNullableAny
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithNothing

Response:
class SamTypeApproximator(builtIns: KotlinBuiltIns, languageVersionSettings: LanguageVersionSettings) {
    private val typeApproximator = TypeApproximator(builtIns, languageVersionSettings)

    fun getSamTypeForValueParameter(
        valueParameter: ValueParameterDescriptor,
        carefulApproximationOfContravariantProjection: Boolean,
    ): KotlinType? {<|endoftext|>


Prompt:
package org.jetbrains.kotlin.config

import org.jetbrains.kotlin.platform.TargetPlatformVersion
import org.jetbrains.org.objectweb.asm.Opcodes

enum class JvmTarget(
    override val description: String,
    val majorVersion: Int,
) : TargetPlatformVersion {

Response:
JVM_1_6("1.6", Opcodes.V1_6),
    JVM_1_8("1.8", Opcodes.V1_8),
    JVM_9("9", Opcodes.V9),
    JVM_10("10", Opcodes.V10),
    JVM_11("11", Opcodes.V11),<|endoftext|>


Prompt:
@DisplayName("works with android tests")
    @GradleAndroidTest
    fun testKotlinAndroidProjectTests(
        gradleVersion: GradleVersion,
        agpVersion: String,
        jdkVersion: JdkVersions.ProvidedJdk,
    ) {
        project(
            "AndroidIncrementalMultiModule",
            gradleVersion,

Response:
buildOptions = defaultBuildOptions.copy(androidVersion = agpVersion),
            buildJdk = jdkVersion.location
        ) {
            testConfigurationCacheOf(
                ":app:compileDebugAndroidTestKotlin",
                ":app:compileDebugUnitTestKotlin"
            )
        }
    }
}<|endoftext|>


Prompt:
fun longTimeMarkRoundingEqualHashCode() {
        run {
            val step = Long.MAX_VALUE / 4
            val timeSource = LongTimeSource(DurationUnit.NANOSECONDS)
            val mark0 = timeSource.markNow() + step.nanoseconds + step.nanoseconds
            timeSource.reading += step

Response:
val mark1 = timeSource.markNow() + step.nanoseconds
            timeSource.reading += step
            val mark2 = timeSource.markNow()
            assertEqualMarks(mark1, mark2)
            assertEqualMarks(mark0, mark2)
            assertEqualMarks(mark0, mark1)
        }

        for (unit in units) {<|endoftext|>


Prompt:
setResult(factory, valueElement)
    }

    val synthetic: Boolean get() = outputValue.element == null

    override val outputValue: PseudoValue
        get() = resultValue!!

    override fun accept(visitor: InstructionVisitor) = visitor.visitMagic(this)

Response:
override fun <R> accept(visitor: InstructionVisitorWithResult<R>): R = visitor.visitMagic(this)

    override fun createCopy() =
        MagicInstruction(element, blockScope, inputValues, kind).setResult(resultValue)

    override fun toString() = renderInstruction("magic[$kind]", render(element))
}<|endoftext|>


Prompt:
// TESTCASE NUMBER: 10
fun case_10(x: Any?) {
    when (x) {
        !is Pair<*, *>? -> return
        else -> {
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Pair<*, *>?")!>x<!>

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Pair<*, *>?"), DEBUG_INFO_SMARTCAST!>x<!>?.first
        }
    }
    <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Pair<*, *>?")!>x<!><|endoftext|>


Prompt:
moduleDescriptor, KonanManglerDesc,
        DescriptorByIdSignatureFinderImpl.LookupMode.MODULE_ONLY
    )

    private fun IdSignature.isInteropSignature() = IdSignature.Flags.IS_NATIVE_INTEROP_LIBRARY.test()

    override fun contains(idSig: IdSignature): Boolean {

Response:
if (idSig.isPubliclyVisible) {
            if (idSig.isInteropSignature()) {
                // TODO: add descriptor cache??
                return descriptorByIdSignatureFinder.findDescriptorBySignature(idSig) != null
            }
        }

        return false
    }<|endoftext|>


Prompt:
val foo = object {
        fun bar() {}
    }

    fun bar() = object {
        val foo = 239
    }

    class Nested
}

class D {
    companion object {
        val foo = object {
            fun bar() {}
        }

        fun bar() = object {
            val foo = 239
        }
    }
}

Response:
// FILE:c.kt
import <!PACKAGE_CANNOT_BE_IMPORTED!>a<!>
import a.<!PACKAGE_CANNOT_BE_IMPORTED!>b<!>

import a.foo
import a.<!UNRESOLVED_IMPORT!>foo<!>.bar
import a.bar<|endoftext|>


Prompt: when { value_1.case_8_3(value_2, value_3, value_4) == null -> println(value_3.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toByte<!>()) }

Response: when { value_1.case_8_3(value_2, value_3, value_4) == null -> println(value_4<!UNSAFE_CALL!>.<!>length) }<|endoftext|>


Prompt:
fun baz(a: Foo, t: Foo, d: Data) {
        a.bar = t.bar
        a.<!INVISIBLE_SETTER!>foo<!> = t.foo

        if (d.x is B) {
            d.x.bar = d.x.bar + ""

Response:
d.x.<!INVISIBLE_SETTER!>foo<!> = d.x.foo + ""
        }
    }
}<|endoftext|>


Prompt:
* A *jumping phase* is a phase that can request the phase-specific information during that same phase from another declaration.
 *
 * Currently, we have four ***jumping phases***:
 *
 * - [COMPILER_REQUIRED_ANNOTATIONS] – The compiler can jump from the use site of an annotation to the annotation class
 *   and resolve its annotations as well.

Response:
* - [SUPER_TYPES] – The compiler resolves super types recursively for all classes from the bottom class to the top one.
 * - [STATUS] – The compiler resolves the status for super declarations first.
 * - [IMPLICIT_TYPES_BODY_RESOLVE] – The compiler can jump from one declaration to another during this phase as one<|endoftext|>


Prompt:
if (-1 !in collection.indices != !range0.contains(-1)) throw AssertionError()
    if (!(-1 in collection.indices) != !range0.contains(-1)) throw AssertionError()
    if (!(-1 !in collection.indices) != range0.contains(-1)) throw AssertionError()
    // no local optimizations

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


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

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

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

import kotlin.contracts.*

Response:
import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl
import org.jetbrains.kotlin.fir.builder.toMutableOrEmpty<|endoftext|>


Prompt:
convertBuiltinType(type)?.let { return it }
        if (type.sort == ARRAY) {
            return TypeArray(Type(AsmUtil.correctElementType(type)))
        }
        return FqName(type.internalName)
    }

    @Suppress("FunctionName")
    fun FqName(internalOrFqName: String): JCTree.JCExpression {

Response:
val path = getQualifiedName(internalOrFqName).split('.')
        assert(path.isNotEmpty())
        return FqName(path)
    }

    @Suppress("FunctionName")
    fun FqName(fqName: FqName) = FqName(fqName.pathSegments().map { it.asString() })

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


Prompt:
val tryBuilder = JsAstProtoBuf.Try.newBuilder()
                tryBuilder.tryBlock = serialize(x.tryBlock)
                x.catches.firstOrNull()?.let { c ->
                    val catchBuilder = JsAstProtoBuf.Catch.newBuilder()
                    catchBuilder.parameter = serializeParameter(c.parameter)

Response:
catchBuilder.body = serialize(c.body)
                    tryBuilder.catchBlock = catchBuilder.build()
                }
                x.finallyBlock?.let { tryBuilder.finallyBlock = serialize(it) }
                builder.tryStatement = tryBuilder.build()
            }

            override fun visitEmpty(x: JsEmpty) {<|endoftext|>


Prompt:
val makePerFileCaches = cacheMode == CacheMode.Alias.STATIC_PER_FILE_EVERYWHERE
        val useHeaders = cacheMode == CacheMode.Alias.STATIC_USE_HEADERS_EVERYWHERE

        return if (defaultCache == CacheMode.Alias.NO)
            CacheMode.WithoutCache
        else CacheMode.WithStaticCache(
            distribution,

Response:
kotlinNativeTargets,
            optimizationMode,
            useStaticCacheForUserLibraries,
            makePerFileCaches,
            useHeaders,
            cacheMode
        )
    }

    private fun computeTestMode(enforcedProperties: EnforcedProperties): TestMode =<|endoftext|>


Prompt:
var font: String
    var textAlign: CanvasTextAlign
    var textBaseline: CanvasTextBaseline
    var direction: CanvasDirection
}

public external interface CanvasPath {
    fun closePath()
    fun moveTo(x: Double, y: Double)
    fun lineTo(x: Double, y: Double)

Response:
fun quadraticCurveTo(cpx: Double, cpy: Double, x: Double, y: Double)
    fun bezierCurveTo(cp1x: Double, cp1y: Double, cp2x: Double, cp2y: Double, x: Double, y: Double)
    fun arcTo(x1: Double, y1: Double, x2: Double, y2: Double, radius: Double)<|endoftext|>


Prompt:
// considered to be non-user-reproducible code for the purposes of these tests
    checkExactType<Buildee<UserKlass>>(buildee)
}

// PTV is in producing position (materialize-case) and passed to a mutable extension property
fun testMaterializeWithMutableProperty() {
    val buildee = build {
        this.typeInfoSourcingVariable
    }

Response:
// exact type equality check — turns unexpected compile-time behavior into red code
    // considered to be non-user-reproducible code for the purposes of these tests
    checkExactType<Buildee<UserKlass>>(buildee)
}

/* REQUIRED DECLARATIONS */

class Buildee<CT>

fun <FT> build(
    instructions: Buildee<FT>.() -> Unit<|endoftext|>


Prompt:
fun test1(): Boolean {
    test1@ for(i in 1..2) {
        continue@test1
        return false
    }

    return true
}

fun test2(): Boolean {
    test2@ while (true) {
        break@test2
    }

    return true
}

fun box(): String {
    if (!test1()) return "fail test1"

Response:
if (!test2()) return "fail test2"
    return "OK"
}<|endoftext|>


Prompt:
ProgressionDirection.INCREASING -> conditionForIncreasing()
                    ProgressionDirection.UNKNOWN -> {
                        // If the direction is unknown, we check depending on the "step" value:
                        //   // (use `<` if last is exclusive)
                        //   (step > 0 && inductionVar <= last) || (step < 0 || last <= inductionVar)
                        context.oror(

Response:
context.andand(
                                irCall(builtIns.greaterFunByOperandType.getValue(stepClass.symbol)).apply {
                                    putValueArgument(0, stepExpression.shallowCopy())
                                    putValueArgument(1, zeroStepExpression())
                                },
                                conditionForIncreasing()
                            ),
                            context.andand(<|endoftext|>


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

/**
 * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.
 */
@kotlin.internal.InlineOnly

Response:
public inline fun <T> Array<out T>.getOrElse(index: Int, defaultValue: (Int) -> T): T {
    contract {
        callsInPlace(defaultValue, InvocationKind.AT_MOST_ONCE)
    }
    return if (index in indices) get(index) else defaultValue(index)
}

/**<|endoftext|>


Prompt:
}

        fun defineEntriesField() {
            irClass.declarations.add(0, entriesField)
            entriesField.parent = irClass
            val irBuilder = context.createIrBuilder(entriesField.symbol, irClass.startOffset, irClass.endOffset)
            entriesField.initializer = irBuilder.irExprBody(irBuilder.irBlock {

Response:
val irValuesArray = irTemporary(irGetField(null, valuesField))
                val irEntriesArray = this@EnumClassLowering.context.createArrayOfExpression(
                        startOffset, endOffset,
                        irClass.defaultType,
                        enumEntriesMap.values
                                .sortedBy { it.ordinal }
                                .map {<|endoftext|>


Prompt:
// There is no sense to resolve such declarations as they do not have bodies
        // Also, they have STUB expression instead of default values, so we shouldn't change them
        if (target is FirCallableDeclaration && target.isCopyCreatedInScope) return

        when (target) {

Response:
is FirFile, is FirScript, is FirRegularClass, is FirCodeFragment -> error("Should have been resolved in ${::doResolveWithoutLock.name}")
            is FirConstructor -> resolve(target, BodyStateKeepers.CONSTRUCTOR)
            is FirFunction -> resolve(target, BodyStateKeepers.FUNCTION)
            is FirProperty -> resolve(target, BodyStateKeepers.PROPERTY)<|endoftext|>


Prompt:
class VisitorState(val insideTryBlock: Boolean, val isTailExpression: Boolean)

    val isUnitReturn = irFunction.returnType.isUnit()
    var hasNotTailSuspendCall = false
    val tailSuspendCalls = mutableSetOf<IrCall>()
    val tailReturnableBlocks = mutableSetOf<IrReturnableBlockSymbol>()

Response:
val visitor = object : IrElementVisitor<Unit, VisitorState> {
        override fun visitElement(element: IrElement, data: VisitorState) {
            element.acceptChildren(this, VisitorState(data.insideTryBlock, isTailExpression = false))
        }

        override fun visitTypeOperator(expression: IrTypeOperatorCall, data: VisitorState) {<|endoftext|>


Prompt:
@OverloadResolutionByLambdaReturnType
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun <R : Comparable<R>> UShortArray.maxOf(selector: (UShort) -> R): R {
    if (isEmpty()) throw NoSuchElementException()
    var maxValue = selector(this[0])
    for (i in 1..lastIndex) {

Response:
val v = selector(this[i])
        if (maxValue < v) {
            maxValue = v
        }
    }
    return maxValue
}

/**
 * Returns the largest value among all values produced by [selector] function
 * applied to each element in the array or `null` if there are no elements.
 *<|endoftext|>


Prompt:
if (x != null) {
        x.length // OK
        y<!UNSAFE_CALL!>.<!>length // Bad
        z<!UNSAFE_CALL!>.<!>length // Bad
    }
    if (y != null) {
        x<!UNSAFE_CALL!>.<!>length // Bad
        y.length // OK

Response:
z<!UNSAFE_CALL!>.<!>length // Bad
    }

    if (z != null) {
        x<!UNSAFE_CALL!>.<!>length // Bad
        y<!UNSAFE_CALL!>.<!>length // Bad
        z.length // OK
    }

    y = null

    if (x != null) {<|endoftext|>


Prompt:
a.<!UNRESOLVED_REFERENCE!>length<!> // // can be ok
    }
}

fun test_6(a: String?) {
    var b = a?.length
    if (b != null) {
        a<!UNSAFE_CALL!>.<!>length // can be ok
    }
    nonInPlaceRun {
        b = 0
    }

Response:
if (b != null) {
        a<!UNSAFE_CALL!>.<!>length // not ok
    }
}<|endoftext|>


Prompt:
// LANGUAGE: -UseConsistentRulesForPrivateConstructorsOfSealedClasses
// ISSUE: KT-44866, KT-49729

// FILE: base.kt
sealed class SealedBase(x: Int) {
    private constructor(y: String) : this(y.length)

    class SealedNested : SealedBase("nested")
}

Response:
class SealedOuter : <!RESOLUTION_TO_PRIVATE_CONSTRUCTOR_OF_SEALED_CLASS!>SealedBase<!>("outer")

abstract class RegularBase(x: Int) {
    private constructor(y: String) : this(y.length)

    class RegularNested : RegularBase("nested")
}<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("orherpackage.EmptyClass13 & orherpackage.EmptyClass13?")!>x<!>.funNullableAny()
        <!DEBUG_INFO_EXPRESSION_TYPE("orherpackage.EmptyClass13 & orherpackage.EmptyClass13?"), DEBUG_INFO_SMARTCAST!>x<!>
    }<!>

Response:
// TESTCASE NUMBER: 14
fun case_14() {
    val a = Class()
    if (a.prop_6 != a.prop_7) {
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>a.prop_6<!><|endoftext|>


Prompt:
override fun afterChange(property: KProperty<*>, oldValue: T, newValue: T) = onChange(property, oldValue, newValue)
        }

    /**
     * Returns a property delegate for a read/write property that calls a specified callback function when changed,
     * allowing the callback to veto the modification.
     * @param initialValue the initial value of the property.

Response:
* @param onChange the callback which is called before a change to the property value is attempted.
     *  The value of the property hasn't been changed yet, when this callback is invoked.
     *  If the callback returns `true` the value of the property is being set to the new value,
     *  and if the callback returns `false` the new value is discarded and the property remains its old value.
     *<|endoftext|>


Prompt:
val aggregatedStats = HashMap<DeclarationType, AggregatedStatsRow>()

        override fun writeHeader(header: StatsOutput.StatsHeader) {
            check(header is RawStatsCollector.RawStatsHeader)
            // do nothing
        }

        override fun writeRow(row: StatsOutput.StatsRow) {
            check(row is RawStatsCollector.RawStatsRow)

Response:
val declarationType = row.statsKey.declarationType
            val aggregatedStatsRow = aggregatedStats.getOrPut(declarationType) { AggregatedStatsRow(declarationType) }
            when (row.common) {
                LIFTED_UP -> aggregatedStatsRow.liftedUp++
                EXPECT -> aggregatedStatsRow.successfullyCommonized++
                MISSING -> {<|endoftext|>


Prompt:
class Scope(val depth: Int, nodes: List<Node>) : Node() {
            val nodes = mutableSetOf<Node>().also { it += nodes }
        }
    }

    // Note: scopes form a tree.
    class FunctionBody(val rootScope: Node.Scope, val allScopes: List<Node.Scope>,
                       val returns: Node.Variable, val throws: Node.Variable) {

Response:
inline fun forEachNonScopeNode(block: (Node) -> Unit) {
            for (scope in allScopes)
                for (node in scope.nodes)
                    if (node !is Node.Scope)
                        block(node)
        }
    }

    class Function(val symbol: FunctionSymbol, val body: FunctionBody) {

        fun debugOutput() = println(debugString())<|endoftext|>


Prompt:
public fun kotlin.CharSequence.findAnyOf(strings: kotlin.collections.Collection<kotlin.String>, startIndex: kotlin.Int = ..., ignoreCase: kotlin.Boolean = ...): kotlin.Pair<kotlin.Int, kotlin.String>?

@kotlin.internal.InlineOnly

Response: public inline fun kotlin.CharSequence.findLast(predicate: (kotlin.Char) -> kotlin.Boolean): kotlin.Char?<|endoftext|>


Prompt:
build(":compileAppleMainKotlinMetadata", buildOptions = testSourceSetsDependingOnMainParameterOption) {
                    assertTestSourceSetsDependingOnMainParameter()
                }

                build(":compileIosMainKotlinMetadata", buildOptions = testSourceSetsDependingOnMainParameterOption) {
                    assertTestSourceSetsDependingOnMainParameter()
                }
            }
        }
    }

Response:
private fun testSingleNativePlatform(projectName: String, gradleVersion: GradleVersion) {

        val posixInIntransitiveMetadataConfigurationRegex = Regex(""".*intransitiveMetadataConfiguration:.*([pP])osix""")

        nativeProject(projectName, gradleVersion) {<|endoftext|>


Prompt:
private object B88 { val a = B87.a + Random.nextInt(100) }
private object B89 { val a = B88.a + Random.nextInt(100) }
private object B90 { val a = B89.a + Random.nextInt(100) }
private object B91 { val a = B90.a + Random.nextInt(100) }

Response:
private object B92 { val a = B91.a + Random.nextInt(100) }
private object B93 { val a = B92.a + Random.nextInt(100) }
private object B94 { val a = B93.a + Random.nextInt(100) }
private object B95 { val a = B94.a + Random.nextInt(100) }<|endoftext|>


Prompt:
inline fun <T, R> with(receiver: T, block: T.() -> R): R {/* DeclarationStructureElement */
    return receiver.block()
}

inline fun <T, R> T.let(block: (T) -> R): R {/* DeclarationStructureElement */
    return block(this)
}

class A {/* ClassDeclarationStructureElement */

Response:
fun foo() {/* DeclarationStructureElement */
        val a = with(1) {
            this.let { it }
        }.let { 2 }
    }
}<|endoftext|>


Prompt:
val signatureWriter = BothSignatureWriter(BothSignatureWriter.Mode.SKIP_CHECKS)
        typeMapper.mapType(type, mode, signatureWriter)

        val canonicalSignature = signatureWriter.toString()
        require(!canonicalSignature.contains(SpecialNames.ANONYMOUS_STRING))

        if (canonicalSignature.contains("L<error>")) return null

Response:
if (canonicalSignature.contains(SpecialNames.NO_NAME_PROVIDED.asString())) return null

        val signature = StringCharacterIterator(canonicalSignature)
        val javaType = SignatureParsing.parseTypeString(signature, StubBuildingVisitor.GUESSING_MAPPER)
        val typeInfo = TypeInfo.fromString(javaType, false)<|endoftext|>


Prompt: 0x0ca9, 0x0caa, 0x0cb4, 0x0cb5, 0x0cba,

Response: 0x0cbc, 0x0cc0, 0x0cc5, 0x0cc7, 0x0ccc, 0x0cce, 0x0cd5, 0x0cd7, 0x0cde, 0x0ce2, 0x0ce4, 0x0ce6, 0x0cf0, 0x0cf3, 0x0d00, 0x0d02,<|endoftext|>


Prompt:
createExpressionByPattern("if ($0) $1 else $2", condition, thenExpr, elseExpr) as KtIfExpression
        else
            createExpressionByPattern("if ($0) $1", condition, thenExpr)) as KtIfExpression
    }

    fun createArgument(
        expression: KtExpression?,
        name: Name? = null,

Response:
isSpread: Boolean = false,
        reformat: Boolean = true
    ): KtValueArgument {
        val argumentList = buildByPattern(
            { pattern, args -> createByPattern(pattern, *args, reformat = reformat) { createCallArguments(it) } }) {
            appendFixedText("(")

            if (name != null) {
                val asString = name.asString()<|endoftext|>


Prompt:
val container = annotations.firstOrNull { it.annotationClass.java == containerClass }
        if (container != null) {
            // A repeatable annotation container must have a method "value" returning the array of repeated annotations.
            val valueMethod = container::class.java.getMethod("value")
            @Suppress("UNCHECKED_CAST")
            return (valueMethod(container) as Array<T>).asList()

Response:
}
    }

    return emptyList()
}

@Suppress("UNCHECKED_CAST")
private object Java8RepeatableContainerLoader {
    class Cache(val repeatableClass: Class<out Annotation>?, val valueMethod: Method?)

    var cache: Cache? = null

    private fun buildCache(): Cache {
        val repeatableClass = try {<|endoftext|>


Prompt:
(MFVC1(5.0, 100) as Any) != MFVC1(3, 100) -> "Fail 1.2"
    MFVC1(5.0, 100) != (MFVC1(3, 100) as Any) -> "Fail 1.3"
    (MFVC1(5.0, 100) as Any) != (MFVC1(3, 100) as Any) -> "Fail 1.4"

Response:
MFVC2(Generic("aba", 5.0), 100) != MFVC2(Generic(3, 8), 100) -> "Fail 2.1"
    (MFVC2(Generic("aba", 5.0), 100) as Any) != MFVC2(Generic(3, 8), 100) -> "Fail 2.2"<|endoftext|>


Prompt:
is FirIntersectionCallableSymbol -> {
                        val nonSubsumedOverriddenSymbols = symbol.getNonSubsumedOverriddenSymbols(
                            sessionHolder.session,
                            sessionHolder.scopeSession
                        )
                        val overriddenSymbols = nonSubsumedOverriddenSymbols.map { it.originalForSubstitutionOverride ?: it }

Response:
addAllSymbolsFrom(overriddenSymbols, sessionHolder)
                        for (intersectedSymbol in overriddenSymbols) {
                            overrideIntersections.getOrPut(intersectedSymbol) { hashSetOf() }.addAll(overriddenSymbols)
                        }
                    }
                    else -> allSymbols.add(symbol)
                }
            }
        }<|endoftext|>


Prompt:
with(builder) {
            defaultDirectives {
                +ConfigurationDirectives.WITH_STDLIB
            }
        }
    }
}

abstract class AbstractSourceNonLocalDeclarationAnchorTest : AbstractNonLocalDeclarationAnchorTest() {

Response:
override val configurator: AnalysisApiTestConfigurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
}

abstract class AbstractScriptNonLocalDeclarationAnchorTest : AbstractNonLocalDeclarationAnchorTest() {<|endoftext|>


Prompt:
public Set<Entry<Integer, Integer>> entrySet() {
        return null;
    }
}

// FILE: m.kt
fun foo(x: Int2IntMap): String {
    if (!x.containsKey(56)) return "fail 1"
    if (x.containsKey(239)) return "fail 1"
    return "OK"
}

fun box(): String {

Response:
return foo(Int2IntMapImpl())
}<|endoftext|>


Prompt:
*  - FE 1.0, since it does not support custom functional kinds from plugins
         *  - places in FIR where session is not accessible by design (like in renderer of FIR elements)
         */
        @JvmStatic
        @AllowedToUsedOnlyInK1
        val Default = FunctionTypeKindExtractor(
            listOf(
                FunctionTypeKind.Function,
                FunctionTypeKind.SuspendFunction,

Response:
FunctionTypeKind.KFunction,
                FunctionTypeKind.KSuspendFunction,
            )
        )
    }

    private val knownKindsByPackageFqName = kinds.groupBy { it.packageFqName }

    fun getFunctionalClassKind(packageFqName: FqName, className: String): FunctionTypeKind? {<|endoftext|>


Prompt:
override fun saveExtension(project: JpsProject, componentTag: Element) {
    }
}

internal class KotlinCompilerSettingsSerializer : BaseJpsCompilerSettingsSerializer<CompilerSettings>(
    SettingConstants.KOTLIN_COMPILER_SETTINGS_SECTION, ::CompilerSettings
) {

Response:
override fun onLoad(project: JpsProject, settings: CompilerSettings) {
        project.kotlinCompilerSettings = settings
    }
}

internal class KotlinJpsPluginSettingsSerializer : BaseJpsCompilerSettingsSerializer<JpsPluginSettings>(
    SettingConstants.KOTLIN_JPS_PLUGIN_SETTINGS_SECTION, ::JpsPluginSettings
) {<|endoftext|>


Prompt:
* This class should be invisible for checkers, but should be only used by DiagnosticCollectorVisitor who runs those checkers
 * It contains all context-modification-related methods unlike CheckerContext that is assumed to be read-only
 */
abstract class CheckerContextForProvider(
    sessionHolder: SessionHolder,
    returnTypeCalculator: ReturnTypeCalculator,
    allInfosSuppressed: Boolean,

Response:
allWarningsSuppressed: Boolean,
    allErrorsSuppressed: Boolean
) : AbstractCheckerContext(sessionHolder, returnTypeCalculator, allInfosSuppressed, allWarningsSuppressed, allErrorsSuppressed) {

    abstract fun addSuppressedDiagnostics(
        diagnosticNames: Collection<String>,
        allInfosSuppressed: Boolean,<|endoftext|>


Prompt:
visitVarInsn(ALOAD, 1)
        val continuationInternalName = CONTINUATION_ASM_TYPE.internalName

        visitTypeInsn(
            CHECKCAST,
            continuationInternalName
        )
        visitMethodInsn(
            INVOKESTATIC,
            packagePartClassInternalName,
            signatureOfRealDeclaration.asmMethod.name,

Response:
signatureOfRealDeclaration.asmMethod.descriptor,
            false
        )
        visitInsn(ARETURN)
        visitEnd()
    }

    writeSyntheticClassMetadata(lambdaBuilder, state.config, false)

    lambdaBuilder.done(state.config.generateSmapCopyToAnnotation)
    return lambdaBuilder.thisName
}<|endoftext|>


Prompt:
var receiverParameter: FirReceiverParameter? = null
    var deprecationsProvider: DeprecationsProvider = UnresolvedDeprecationProvider
    var containerSource: DeserializedContainerSource? = null
    var dispatchReceiverType: ConeSimpleKotlinType? = null
    val contextReceivers: MutableList<FirContextReceiver> = mutableListOf()
    lateinit var name: Name

Response:
var delegate: FirExpression? = null
    var isVar: Boolean by kotlin.properties.Delegates.notNull<Boolean>()
    var isVal: Boolean by kotlin.properties.Delegates.notNull<Boolean>()
    var getter: FirPropertyAccessor? = null
    var setter: FirPropertyAccessor? = null
    var backingField: FirBackingField? = null<|endoftext|>


Prompt:
package org.jetbrains.kotlin.objcexport.extras

import org.jetbrains.kotlin.backend.konan.objcexport.ObjCNullableReferenceType
import org.jetbrains.kotlin.backend.konan.objcexport.ObjCType
import org.jetbrains.kotlin.name.ClassId

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

private val originClassIdKey = extrasKeyOf<ClassId?>()

/**
 * Tracks the Kotlin origin associated with [this] [ObjCType].<|endoftext|>


Prompt:
testGroup("compiler/fir/raw-fir/light-tree2fir/tests-gen", "compiler/fir/raw-fir/psi2fir/testData") {
            testClass<AbstractLightTree2FirConverterTestCase> {
                model("rawBuilder")
            }
        }

Response:
testGroup("compiler/fir/analysis-tests/legacy-fir-tests/tests-gen", "compiler/testData") {
            testClass<AbstractFirTypeEnhancementTest> {
                model("loadJava/compiledJava", extension = "java")
            }
        }<|endoftext|>


Prompt: val cOutOfRaneMin = <!TOO_MANY_CHARACTERS_IN_CHARACTER_LITERAL!>'𐀀'<!> //u+10000

Response:
val cOutOfRangeAroundMax = <!TOO_MANY_CHARACTERS_IN_CHARACTER_LITERAL!>''<!> //u+Dfffff
}<|endoftext|>


Prompt:
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// SAM_CONVERSIONS: INDY
// FULL_JDK

// CHECK_BYTECODE_TEXT
// JVM_IR_TEMPLATES
// 2 java/lang/invoke/LambdaMetafactory

// FILE: serializableLambdaCapturingInlineClassInt.kt
import java.io.*

Response:
inline class IC(val x: Int)

fun box(): String {
    val k = IC('K'.toInt())
    return roundtrip(Sam { s -> s + k.x.toChar().toString() })
        .get("O")
}

fun <T> roundtrip(x: T): T {
    val out1 = ByteArrayOutputStream()<|endoftext|>


Prompt:
* NUMBER: 3
 * DESCRIPTION: contracts with not allowed complex conditions in implies.
 */

import kotlin.contracts.*

// TESTCASE NUMBER: 1
fun case_1(value_1: Boolean?): Boolean {
    contract { returns(true) implies (value_1 != null && <!ERROR_IN_CONTRACT_DESCRIPTION!>value_1 == false<!>) }

Response:
return value_1 != null && value_1 == false
}

// TESTCASE NUMBER: 2
fun case_2(value_1: Boolean, value_2: Boolean): Boolean? {
    contract { returnsNotNull() implies (<!ERROR_IN_CONTRACT_DESCRIPTION!>value_1 != false<!> || value_2) }<|endoftext|>


Prompt:
irClass.isAny() -> NullPointer(runtime.typeInfoType)
            irClass.isKotlinObjCClass() -> context.ir.symbols.any.owner.typeInfoPtr
            else -> {
                val superTypeOrAny = irClass.getSuperClassNotAny() ?: context.ir.symbols.any.owner
                superTypeOrAny.typeInfoPtr
            }
        }

Response:
val implementedInterfaces = irClass.implementedInterfaces.filter { it.requiresRtti() }

        val interfaces = implementedInterfaces.map { it.typeInfoPtr }
        val interfacesPtr = staticData.placeGlobalConstArray("kintf:$className",
                pointerType(runtime.typeInfoType), interfaces)

        val objOffsets = getObjOffsets(bodyType)<|endoftext|>


Prompt:
* Returns an array with all elements of this array sorted according to their natural sort order.
 */
public fun ByteArray.sortedArray(): ByteArray {
    if (isEmpty()) return this
    return this.copyOf().apply { sort() }
}

/**
 * Returns an array with all elements of this array sorted according to their natural sort order.
 */
public fun ShortArray.sortedArray(): ShortArray {

Response:
if (isEmpty()) return this
    return this.copyOf().apply { sort() }
}

/**
 * Returns an array with all elements of this array sorted according to their natural sort order.
 */
public fun IntArray.sortedArray(): IntArray {
    if (isEmpty()) return this
    return this.copyOf().apply { sort() }
}

/**<|endoftext|>


Prompt:
expect(listOf(2000000000000), { longArrayOf(3000000000000, 2000000000000).drop(1) })
        expect(listOf(3.toByte()), { byteArrayOf(2, 3).drop(1) })
        expect(listOf(3.toShort()), { shortArrayOf(2, 3).drop(1) })

Response:
expect(listOf(3.0f), { floatArrayOf(2f, 3f).drop(1) })
        expect(listOf(3.0), { doubleArrayOf(2.0, 3.0).drop(1) })
        expect(listOf(false), { booleanArrayOf(true, false).drop(1) })<|endoftext|>


Prompt:
callGraph.directEdges[callee]?.let { escapeAnalysisResults[it.symbol]!! }
                            ?: getExternalFunctionEAResult(it)
                pointsToGraph.processCall(it, calleeEAResult)

                if (pointsToGraph.allNodes.size > maxAllowedGraphSize)
                    return false
            }

            context.log { "After calls analysis" }

Response:
pointsToGraph.log()
            pointsToGraph.logDigraph(false)

            // Build transitive closure.
            val eaResult = pointsToGraph.buildClosure()

            context.log { "After closure building" }
            pointsToGraph.log()
            pointsToGraph.logDigraph(true)

            escapeAnalysisResults[function] = eaResult

            return true
        }<|endoftext|>


Prompt:
value == "true"
        )
        LIVE_LITERALS_V2_ENABLED_OPTION -> configuration.put(
            ComposeConfiguration.LIVE_LITERALS_V2_ENABLED_KEY,
            value == "true"
        )
        GENERATE_FUNCTION_KEY_META_CLASSES_OPTION -> configuration.put(

Response:
ComposeConfiguration.GENERATE_FUNCTION_KEY_META_CLASSES_KEY,
            value == "true"
        )
        SOURCE_INFORMATION_ENABLED_OPTION -> configuration.put(
            ComposeConfiguration.SOURCE_INFORMATION_ENABLED_KEY,
            value == "true"
        )
        METRICS_DESTINATION_OPTION -> configuration.put(<|endoftext|>


Prompt:
// A compiled file for a class should only contain a single class declaration. `*Kt.class` files on the other hand may contain
            // top-level callables and need to be skipped.
            val classOrObject = ktFile.declarations.singleOrNull() as? KtClassOrObject ?: return
            handleCompiledClassDeclaration(classOrObject, text)
        } else {

Response:
ktFile.collectDescendantsOfType<KtClassOrObject>()
                .sortedBy { it.fqName?.asString() ?: it.name.toString() }
                .forEach { classOrObject ->
                    handleClassDeclaration(classOrObject, text)
                    appendLine()
                }
        }
    }

    /**<|endoftext|>


Prompt:
val b: Two<A, C> = <!TYPE_MISMATCH!>foo(outA, inB)<!>
    use(b)
}

fun <T> bar(o: Out<T>, i: In<T>): Two<T, T> = throw Exception("$o $i")

fun test2(outA: Out<A>, inC: In<C>) {

Response:
bar(outA, <!ARGUMENT_TYPE_MISMATCH!>inC<!>)

    val b: Two<A, B> = <!INITIALIZER_TYPE_MISMATCH!>bar(outA, <!ARGUMENT_TYPE_MISMATCH!>inC<!>)<!>
    use(b)
}<|endoftext|>


Prompt:
private fun PsiAnnotationMemberValue.renderAnnotationMemberValue(): String = when (this) {
        is KtLightPsiArrayInitializerMemberValue -> "{${initializers.joinToString { it.renderAnnotationMemberValue() }}}"
        is PsiAnnotation -> renderAnnotation()
        is KtLightPsiLiteral -> renderKtLightPsiLiteral()
        else -> text
    }

Response:
private fun PsiMethod.renderMethod() =
        renderModifiers(returnType) +
                (if (isVarArgs) "/* vararg */ " else "") +
                typeParameters.renderTypeParams() +
                (returnType?.renderType() ?: "") + " " +
                name +<|endoftext|>


Prompt:
package kotlin.jdk7.test

import test.platformNull
import java.io.*
import kotlin.test.*

class UseCloseableResourceTest {

    class Resource(val faultyClose: Boolean = false) : Closeable {

        var isClosed = false
            private set

        override fun close() {
            if (faultyClose)
                throw IOException("Close failed")

Response:
isClosed = true
        }
    }

    @Test fun success() {
        val resource = Resource()
        val result = resource.use { "ok" }
        assertEquals("ok", result)
        assertTrue(resource.isClosed)
    }

    @Test fun closeFails() {
        val e = assertFails {<|endoftext|>


Prompt:
options.freeCompilerArgs.get()
            }
        }

        set(value) = if (isTaskExecuting) {
            task().nagUserFreeArgsModifiedOnExecution(value)
            task().executionTimeFreeCompilerArgs = value
        } else {
            options.freeCompilerArgs.set(value)
        }

    private val isTaskExecuting: Boolean

Response:
get() = task().state.executing
}<|endoftext|>


Prompt:
if (list5.size > 23) break
    }
    if (list5 != listOf<UInt>()) {
        return "Wrong elements for 1u.toUByte() until MinUB step 3: $list5"
    }

    val list6 = ArrayList<UInt>()
    for (i in 1u.toUShort() until MinUS step 3) {

Response:
list6.add(i)
        if (list6.size > 23) break
    }
    if (list6 != listOf<UInt>()) {
        return "Wrong elements for 1u.toUShort() until MinUS step 3: $list6"
    }

    val list7 = ArrayList<UInt>()
    for (i in 1u until MinUI step 3) {<|endoftext|>


Prompt:
getAsFirExpression<FirExpression>(rightArg, "No right operand")
            else
                buildErrorExpression(null, ConeSyntaxDiagnostic("No right operand"))

        val leftArgAsFir = getAsFirExpression<FirExpression>(leftArgNode, "No left operand")

        // No need for the callee name since arguments are already generated

Response:
context.calleeNamesForLambda.removeLast()

        when (operationToken) {
            ELVIS ->
                return leftArgAsFir.generateNotNullOrOther(rightArgAsFir, baseSource)
            ANDAND, OROR ->
                return leftArgAsFir.generateLazyLogicalOperation(rightArgAsFir, operationToken == ANDAND, baseSource)<|endoftext|>


Prompt:
defaultPodGenTaskName,
                    podSetupBuildFullTaskName(anotherPodName),
                    podBuildFullTaskName(anotherPodName),
                    cinteropFullTaskName(anotherPodName)
                )
                assertTasksUpToDate(
                    defaultSetupBuildTaskName,
                    defaultBuildTaskName,
                    defaultCinteropTaskName
                )

                buildGradleKts.removePod(anotherPodName)

Response:
testImport {
                    assertOutputDoesNotContain(podBuildFullTaskName(anotherPodName))
                    assertOutputDoesNotContain(cinteropFullTaskName(anotherPodName))
                    assertTasksUpToDate(
                        defaultBuildTaskName,
                        defaultSetupBuildTaskName,
                        defaultCinteropTaskName
                    )
                }
            }
        }
    }<|endoftext|>


Prompt:
}
            }
            return null
        }

        fun shouldReportParameterNameOverrideWarning(
            parameterFromSubclass: ValueParameterDescriptor,
            parameterFromSuperclass: ValueParameterDescriptor
        ): Boolean {
            return parameterFromSubclass.containingDeclaration.hasStableParameterNames() &&
                    parameterFromSuperclass.containingDeclaration.hasStableParameterNames() &&

Response:
parameterFromSuperclass.name != parameterFromSubclass.name
        }

        private fun checkPropertyKind(descriptor: CallableMemberDescriptor, isVar: Boolean): Boolean {
            return descriptor is PropertyDescriptor && descriptor.isVar == isVar
        }
    }
}<|endoftext|>


Prompt:
ss<!UNSAFE_CALL!>.<!>hashCode() // Smart-cast to Int, should be unsafe call
    val sss = if (true) {
        s?.copy
    }
    else {
        s?.copy
    }
    sss<!UNSAFE_CALL!>.<!>length
}

class My {
    val String.copy2: String

Response:
get() = this

    fun foo() {
        val s: String? = null
        val ss = if (true) {
            s?.length
        } else {
            s?.length
        }
        ss<!UNSAFE_CALL!>.<!>hashCode()
        val sss = if (true) {
            s?.copy2
        }
        else {<|endoftext|>


Prompt:
public fun CloseEventInit(wasClean: Boolean? = false, code: Short? = 0, reason: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): CloseEventInit { js("return { wasClean, code, reason, bubbles, cancelable, composed };") }

/**

Response:
* Exposes the JavaScript [MessageChannel](https://developer.mozilla.org/en/docs/Web/API/MessageChannel) to Kotlin
 */
public external open class MessageChannel : JsAny {
    open val port1: MessagePort
    open val port2: MessagePort
}

/**<|endoftext|>


Prompt:
return messages.joinToString("\n") { "${it.severity}: ${it.message}${it.location?.let{" at $it"} ?: ""}" }
    }
}

fun TestMessageCollector.assertHasMessage(msg: String, desiredSeverity: CompilerMessageSeverity? = null) {

Response:
assert(messages.any { it.message.contains(msg) && (desiredSeverity == null || it.severity == desiredSeverity) }) {
        "Expecting message \"$msg\" with severity ${desiredSeverity?.toString() ?: "Any"}, actual:\n" +<|endoftext|>