Prompt:
add("-cp")
                add(compilationClasspath.joinToString(File.pathSeparator) { it.absolutePath })
            }
        }
        val process = processBuilder.start()
        data class ExceptionContainer(
            var value: Throwable? = null
        )

        fun InputStream.captureStream(): Triple<Thread, ExceptionContainer, ArrayList<String>> {

Response:
val out = ArrayList<String>()
            val exceptionContainer = ExceptionContainer()
            val thread = thread {
                val promptRegex = Regex("(?:\\u001B\\p{Graph}+)*(?:>>> ?|\\.\\.\\.)")
                try {
                    reader().forEachLine { rawLine ->
                        promptRegex.split(rawLine).forEach { line -><|endoftext|>


Prompt:
val irBuiltIns: IrBuiltIns,
    val extensions: StubGeneratorExtensions = StubGeneratorExtensions.EMPTY,
) : IrProvider {
    protected val lazyTable = symbolTable.lazyWrapper

    val lock: IrLock
        get() = symbolTable.lock

    var unboundSymbolGeneration: Boolean
        get() = lazyTable.stubGenerator != null

Response:
set(value) {
            lazyTable.stubGenerator = if (value) this else null
        }

    abstract val typeTranslator: TypeTranslator
    abstract val descriptorFinder: DescriptorByIdSignatureFinder

    private val facadeClassMap = mutableMapOf<DeserializedContainerSource, IrClass?>()<|endoftext|>


Prompt:
elements.mapIndexed { index, element -> 2 * index + 1 to element }.toMap()
    private val elementsToVar: Map<Node, Int> = elements.mapIndexed { index, element -> element.origin to index }.toMap()

    operator fun get(element: Node): Int = elementsToVar.getValue(element)

Response:
operator fun get(index: Int): Node = varToElements.getValue(index)

    val size: Int = elements.size
}

private fun processRequirementsFromConfig(
    solution: MutableList<Boolean>,
    elementMapping: ElementMapping,
    requiredInterfaces: Collection<Node>,
    requiredClasses: Collection<Node>,
) {<|endoftext|>


Prompt:
@Language("JSON") val json =
            """
            {
              "schemaVersion": ${SchemaVersion.current},
              "buildSystem": "Gradle",
              "buildSystemVersion": "6.7",
              "buildPlugin": "org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper",
              "projectSettings": {

Response:
"isHmppEnabled": false,
                "isCompatibilityMetadataVariantEnabled": true
              },
              "projectTargets": []
            }
            """.trimIndent()

        val result = KotlinToolingMetadata.parseJson(json)
        assertTrue(
            result is KotlinToolingMetadataParsingResult.Failure,<|endoftext|>


Prompt:
) : KtAbstractFirDiagnostic<KtDeclaration>(firDiagnostic, token), KtFirDiagnostic.ValueClassNotFinal

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

Response:
) : KtAbstractFirDiagnostic<KtDeclaration>(firDiagnostic, token), KtFirDiagnostic.AbsenceOfPrimaryConstructorForValueClass

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


Prompt:
"Attempt to rebind an IR symbol or to re-create its owner: old owner ${symbol.owner.render()}, new owner ${owner.render()}"
        }
        return owner
    }

    class Flat<Key, SymbolOwner, Symbol>(lock: IrLock, val symbolFilter: (Symbol) -> Boolean = { true }) : SymbolTableSlice<Key, SymbolOwner, Symbol>(lock)

Response:
where SymbolOwner : IrSymbolOwner, Symbol : IrBindableSymbol<*, SymbolOwner> {
        private val signatureToSymbol = hashMapOf<Key, Symbol>()

        override fun get(key: Key): Symbol? {
            return signatureToSymbol[key]
        }

        override fun set(key: Key, symbol: Symbol) {
            if (symbolFilter(symbol)) {<|endoftext|>


Prompt: b -> { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!><!> }

Response:
else -> { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!><!> }
        }
        <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!>
    }<!>

    private val test_4 by lazy {<|endoftext|>


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

            val tasks = listOf(
                podspecTaskName,
                defaultPodGenTaskName,
                defaultSetupBuildTaskName,
                defaultBuildTaskName,
                defaultCinteropTaskName
            )
            val anotherTarget = "MacosX64"

Response:
val anotherSdk = "macosx"
            val anotherFamily = "macos"
            buildGradleKts.addKotlinBlock(anotherTarget.replaceFirstChar { it.lowercase(Locale.getDefault()) } + "()")

            testImport {
                assertTasksExecuted(
                    podGenFullTaskName(anotherFamily),<|endoftext|>


Prompt:
"Configuring JVM toolchain in the Kotlin target level DSL is prohibited. " +
            "JVM toolchain feature should be configured in the extension scope as it affects all JVM targets (JVM, Android)."

internal val KotlinTarget.internal: InternalKotlinTarget
    get() = (this as? InternalKotlinTarget) ?: throw IllegalArgumentException(

Response:
"KotlinTarget($name) ${this::class} does not implement ${InternalKotlinTarget::class}"
    )

internal val InternalKotlinTarget.isSourcesPublishableFuture by extrasStoredFuture {
    KotlinPluginLifecycle.Stage.AfterFinaliseDsl.await()
    isSourcesPublishable
}<|endoftext|>


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

import org.jetbrains.kotlin.fir.diagnostics.FirDiagnosticHolder
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.impl.*

Response:
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract

val FirReference.symbol: FirBasedSymbol<*>?
    get() = when (this) {
        is FirThisReference -> boundSymbol
        is FirResolvedNamedReference -> resolvedSymbol
        is FirNamedReferenceWithCandidateBase -> candidateSymbol
        else -> null
    }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.ir.symbols.IrReturnTargetSymbol
import org.jetbrains.kotlin.ir.symbols.IrReturnableBlockSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.types.*

Response:
import org.jetbrains.kotlin.ir.util.isPrimitiveArray
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
import org.jetbrains.kotlin.ir.util.render

// Copied and adapted from Kotlin/Native

abstract class AbstractValueUsageLowering(
    val context: JsCommonBackendContext,<|endoftext|>


Prompt:
private val FirClassifierSymbol<*>.classIdIfExists: ClassId?
        get() = (this as? FirClassLikeSymbol<*>)?.classId

    private val FirConstructorSymbol.classIdIfExists: ClassId?
        get() = this.containingClassLookupTag()?.classId

    /**

Response:
* Returns true if the class symbol has a type parameter that is supposed to be provided for its parent class.
     *
     * Example:
     * class Outer<T> {
     *   inner class Inner // Inner has an implicit type parameter `T`.
     * }
     */
    private fun FirClassLikeSymbol<*>.hasTypeParameterFromParent(): Boolean = typeParameterSymbols.orEmpty().any {<|endoftext|>


Prompt:
val (supportModuleFiles, nonSupportModuleFiles) = generatedFiles.partition { it.module.isSupport }
            val parsedFiles = nonSupportModuleFiles.associateWith { psiFactory.createFile(it.name, it.text) }
            val nonParsedFiles = supportModuleFiles.toMutableList()

            // Explicitly add support module to other modules' dependencies (as it is not listed there by default).

Response:
val supportModule = modules[SUPPORT_MODULE_NAME]
            if (supportModule != null) {
                modules.forEach { (moduleName, module) ->
                    if (moduleName != SUPPORT_MODULE_NAME && supportModule !in module.dependencies) {
                        module.dependencies += supportModule
                    }
                }
            }

            Triple(modules, parsedFiles, nonParsedFiles)<|endoftext|>


Prompt:
<!CONFLICTING_OVERLOADS!>fun <T: SameUserInterface> testTypeParameterWithTypeAliasedUpperBoundsB(arg: T)<!> {}

<!CONFLICTING_OVERLOADS!>fun <T: UserInterface> testTypeParameterWithTypeAliasedUpperBoundsBReverse(arg: T)<!> {}

Response: <!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T: SameUserInterface> testTypeParameterWithTypeAliasedUpperBoundsBReverse(arg: T)<!> {}<|endoftext|>


Prompt:
a?.<!UNRESOLVED_REFERENCE!>bar<!>()
  }
  if (!(a is B)) {
    return;
  }
  a.bar()
  a.foo()
}

fun f10(init : A?) {
  val a : A? = init
  if (!(a is B)) {
    return;
  }

Response:
if (!(<!USELESS_IS_CHECK!>a is B<!>)) {
    return;
  }
}

class C() : A() {
  fun bar() {

  }
}

fun f101(a : A?) {
    if (a is C) {
      a.bar();
    }
}

fun f11(a : A?) {<|endoftext|>


Prompt:
}

fun KonanTarget.toTargetMachine(objectFactory: ObjectFactory): TargetMachine = object : TargetMachine {
    override fun getOperatingSystemFamily(): OperatingSystemFamily =
            getGradleOSFamily(objectFactory)

    override fun getArchitecture(): MachineArchitecture =
            objectFactory.named(MachineArchitecture::class.java, this@toTargetMachine.architecture.visibleName)
}

Response:
class DefaultKotlinNativePlatform(name: String, override val target: KonanTarget) :
        DefaultNativePlatform(name, target.getGradleOS(), target.getGradleCPU()),
        KotlinNativePlatform {
    constructor(target: KonanTarget) : this(target.visibleName, target)<|endoftext|>


Prompt:
internal val Project.shouldCompileIntermediateSourceSetsToMetadata: Boolean
    get() = with(PropertiesProvider(this)) {
        when {
            !hierarchicalStructureSupport && mppHierarchicalStructureByDefault -> false
            else -> true
        }
    }

internal val Project.isCompatibilityMetadataVariantEnabled: Boolean

Response:
get() = PropertiesProvider(this).enableCompatibilityMetadataVariant == true

class KotlinMetadataTargetConfigurator :
    KotlinOnlyTargetConfigurator<KotlinCompilation<*>, KotlinMetadataTarget>(createTestCompilation = false) {
    companion object {
        internal const val ALL_METADATA_JAR_NAME = "allMetadataJar"
    }<|endoftext|>


Prompt:
*
 * @sample samples.collections.Collections.Transformations.groupByKeysAndValues
 */
public inline fun <K, V, M : MutableMap<in K, MutableList<V>>> ShortArray.groupByTo(destination: M, keySelector: (Short) -> K, valueTransform: (Short) -> V): M {
    for (element in this) {

Response:
val key = keySelector(element)
        val list = destination.getOrPut(key) { ArrayList<V>() }
        list.add(valueTransform(element))
    }
    return destination
}

/**
 * Groups values returned by the [valueTransform] function applied to each element of the original array
 * by the key returned by the given [keySelector] function applied to the element<|endoftext|>


Prompt:
import org.jetbrains.kotlin.utils.addToStdlib.shouldNotBeCalled

object DisabledDescriptorMangler : KotlinMangler.DescriptorMangler {
    override val String.hashMangle: Long
        get() = shouldNotBeCalled()

    override fun DeclarationDescriptor.isExported(compatibleMode: Boolean): Boolean = shouldNotBeCalled()

Response:
override fun DeclarationDescriptor.signatureString(compatibleMode: Boolean): String = shouldNotBeCalled()
}

object DisabledIdSignatureDescriptor : IdSignatureDescriptor(DisabledDescriptorMangler) {
    override fun composeSignature(descriptor: DeclarationDescriptor): IdSignature? = null<|endoftext|>


Prompt:
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactoryImpl
import org.jetbrains.kotlin.test.directives.AdditionalFilesDirectives
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives

Response:
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.MARK_DYNAMIC_CALLS
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
import org.jetbrains.kotlin.test.directives.model.DirectivesContainer<|endoftext|>


Prompt:
package org.jetbrains.kotlin.fir.analysis.checkers.expression

import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.config.AnalysisFlags
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter

Response:
import org.jetbrains.kotlin.diagnostics.reportOn
import org.jetbrains.kotlin.fir.*
import org.jetbrains.kotlin.fir.analysis.checkers.*
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext<|endoftext|>


Prompt:
if (lookupTag.classId != SpecialJvmAnnotations.JAVA_LANG_ANNOTATION_REPEATABLE) return false

        val getClassCall = argumentMap[StandardClassIds.Annotations.ParameterNames.value] as? FirGetClassCall ?: return false
        val classReference = getClassCall.argument as? FirClassReferenceExpression ?: return false

Response:
val containerType = classReference.classTypeRef.coneType as? ConeClassLikeType ?: return false
        val classId = containerType.lookupTag.classId
        if (classId.outerClassId == null || classId.shortClassName.asString() != JvmAbi.REPEATABLE_ANNOTATION_CONTAINER_NAME
        ) return false<|endoftext|>


Prompt:
}
        }

    fun generateUnboundSymbolsAsDependencies(irProviders: List<IrProvider>) {
        ExternalDependenciesGenerator(context.symbolTable, irProviders).generateUnboundSymbolsAsDependencies()
    }

Response:
fun generateSingleFile(irDeclarationGenerator: DeclarationGenerator, ktFile: KtFile, module: IrModuleFragment): IrFileImpl {
        val irFile = createEmptyIrFile(ktFile, module)

        val constantValueGenerator = irDeclarationGenerator.context.constantValueGenerator
        for (ktAnnotationEntry in ktFile.annotationEntries) {<|endoftext|>


Prompt:
val localLabels = argInsns.filterTo(HashSet()) { it is LabelNode }
        return argInsns.any { insn ->
            insn.isStoreOperation() ||
                    insn in methodContext.suspensionJumpLabels ||
                    insn.opcode == Opcodes.GOTO && (insn as JumpInsnNode).label !in localLabels
        }
    }

Response:
private fun moveInplaceArgumentsFromStoresToLoads(methodContext: MethodContext, callContext: CallContext) {
        // Transform call
        val insnList = methodContext.methodNode.instructions
        val args = callContext.args.associateBy { it.varIndex }
        var argsProcessed = 0

        var insn: AbstractInsnNode = callContext.callStartMarker<|endoftext|>


Prompt:
fun lower(irModule: IrModuleFragment)
}

interface FileLoweringPass : ModuleLoweringPass {
    fun lower(irFile: IrFile)

    override fun lower(irModule: IrModuleFragment) {
        for (file in irModule.files) {
            try {
                lower(file)
            } catch (e: CompilationException) {

Response:
e.initializeFileDetails(file)
                throw e
            } catch (e: KotlinExceptionWithAttachments) {
                throw e
            } catch (e: Throwable) {
                throw e.wrapWithCompilationException("Internal error in file lowering", file, null)
            }
        }
    }
}

interface ClassLoweringPass : FileLoweringPass {<|endoftext|>


Prompt:
flow.addAllConditionally(expressionVariable notEq null, previousFlow)

            /*
             * If we have some implication about rhs of safe call in the previous flow, then we can expand them to the whole
             *   safe call variable
             *
             * a?.foo() // original call
             * subj.foo() // rhs of safe call
             *
             * previousFlow:

Response:
*  - subj.foo() == True -> X_1
             *  - subj.foo() == False -> X_2
             *  - subj.foo() != Null -> X_3
             *  - subj.foo() == Null -> X_4
             *
             * flow:
             *  - a?.foo() == True -> X_1<|endoftext|>


Prompt:
"-ProhibitAssigningSingleElementsToVarargsInNamedForm", // Prohibit these assignments
            "-ProhibitDataClassesOverridingCopy",                   // Prohibit as no longer supported
            "-ProhibitOperatorMod",                                 // Prohibit as no longer supported
            "-ProhibitIllegalValueParameterUsageInDefaultArguments",  // Allow only legal values

Response:
"-UseBuilderInferenceOnlyIfNeeded",                     // Run only default one
            "-UseCorrectExecutionOrderForVarargArguments"           // Run only correct one
        )

        private const val USE_EXPERIMENTAL_DIRECTIVE = "USE_EXPERIMENTAL"

        private const val NATIVE_STANDALONE_DIRECTIVE = "NATIVE_STANDALONE"<|endoftext|>


Prompt:
get() = CompilerSystemProperties.OS_NAME.value!!.lowercase().startsWith("windows")

fun String?.toBooleanLenient(): Boolean? = when (this?.lowercase()) {
    null -> false
    in listOf("", "yes", "true", "on", "y") -> true
    in listOf("no", "false", "off", "n") -> false

Response:
else -> null
}<|endoftext|>


Prompt:
private val IrDeclarationWithName.exportedName: String
    get() = getAnnotation(JsStandardClassIds.Annotations.JsName.asSingleFqName())?.getSingleConstStringArgument() ?: name.toString()

@Suppress("UNCHECKED_CAST")
private fun IrConstructorCall.getSingleConstStringArgument() =

Response:
(getValueArgument(0) as IrConst<String>).value

fun IrModuleFragment.collectExportedNames(): Map<IrFile, Map<IrDeclarationWithName, String>> {
    return files.associateWith { irFile ->
        val isFileExported = irFile.annotations.hasAnnotation(JsStandardClassIds.Annotations.JsExport.asSingleFqName())<|endoftext|>


Prompt:
fun staticLib(
        namePrefix: String,
        buildTypes: Collection<NativeBuildType> = NativeBuildType.DEFAULT_BUILD_TYPES,
        configure: StaticLibrary.() -> Unit = {}
    ) = createBinaries(namePrefix, namePrefix, NativeOutputKind.STATIC, buildTypes, ::StaticLibrary, configure)

Response:
/** Creates a static library with the empty name prefix for each build type and configures it. */
    @JvmOverloads
    fun staticLib(
        buildTypes: Collection<NativeBuildType> = NativeBuildType.DEFAULT_BUILD_TYPES,
        configure: StaticLibrary.() -> Unit = {}<|endoftext|>


Prompt:
"Expected KotlinSourceSet: ${kotlinSourceSet.name} to dependsOn commonTest"
                )
            }
        }

        android.testVariants.all { libraryVariant ->
            libraryVariant.sourceSets.forEach { androidSourceSet ->
                val kotlinSourceSet = project.getKotlinSourceSetOrFail(androidSourceSet)
                assertEquals(

Response:
emptySet(), kotlinSourceSet.dependsOn.map { it.name }.toSet(),
                    "Expected KotlinSourceSet: ${kotlinSourceSet.name} to have no dependsOn edges"
                )
            }
        }
    }

    @Test
    fun `test - kotlin source directories - are in sync between KotlinSourceSet and AndroidSourceSet`() {<|endoftext|>


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

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

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

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


Prompt:
// test1.kt:12 box
// test.kt:6 box
// test.kt:7 box
// test1.kt:12 invoke
// test.kt:7 box
// test.kt:8 box

// EXPECTATIONS JS_IR
// test1.kt:11 box
// test.kt:7 box
// test1.kt:9 box$lambda
// test.kt:8 box

Response:
// EXPECTATIONS WASM
// test.kt:6 $box
// test1.kt:12 $box
// test.kt:7 $box
// test.kt:9 $box$lambda.invoke
// test.kt:8 $box<|endoftext|>


Prompt:
endIndex: Int,
    bytesFormat: HexFormat.BytesHexFormat
): ByteArray? {
    val byteSeparatorLength = bytesFormat.byteSeparator.length
    require(byteSeparatorLength <= 1)

    val numberOfChars = endIndex - startIndex
    var charIndex = 0

    if (byteSeparatorLength == 0) {

Response:
if (numberOfChars and 1 != 0) return null
        val numberOfBytes = numberOfChars shr 1
        val byteArray = ByteArray(numberOfBytes)
        for (byteIndex in 0 until numberOfBytes) {
            byteArray[byteIndex] = parseByteAt(charIndex)
            charIndex += 2
        }
        return byteArray
    } else {<|endoftext|>


Prompt:
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalUnsignedTypes::class})
public fun kotlin.Array<out kotlin.UByte>.sum(): kotlin.UInt

@kotlin.jvm.JvmName(name = "sumOfUInt")
@kotlin.SinceKotlin(version = "1.5")

Response:
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalUnsignedTypes::class})
public fun kotlin.Array<out kotlin.UInt>.sum(): kotlin.UInt

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


Prompt:
override fun findClass(name: String): Class<*> = try {
        super.findClass(name)
    } catch (e: ClassNotFoundException) {
        fallbackClassLoader?.loadClass(name) ?: throw e
    }

    override fun getResourceAsStream(name: String): InputStream? =

Response:
super.getResourceAsStream(name) ?: fallbackClassLoader?.getResourceAsStream(name)

    override fun findResources(name: String): Enumeration<URL> =
        if (fallbackClassLoader == null) super.findResources(name)
        else Collections.enumeration(super.findResources(name).toList() + fallbackClassLoader.openFindResources(name).asSequence())<|endoftext|>


Prompt:
val a3 = A()
    if (a3.x != "23") return "fail3: ${a3.x}"

    val b = B("q")
    if (b.x != "q") return "fail4: ${b.x}"

    val c = C("w")
    if (c.x != "w") return "fail5: ${c.x}"

    return "OK"

Response: }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtNamedSymbol
import org.jetbrains.kotlin.backend.konan.KonanFqNames
import org.jetbrains.kotlin.backend.konan.objcexport.*
import org.jetbrains.kotlin.name.Name

Response:
import org.jetbrains.kotlin.objcexport.Predefined.anyMethodSelectors
import org.jetbrains.kotlin.objcexport.Predefined.anyMethodSwiftNames
import org.jetbrains.kotlin.objcexport.analysisApiUtils.*
import org.jetbrains.kotlin.objcexport.extras.objCExportStubExtras<|endoftext|>


Prompt:
override fun replaceBoundSymbol(newBoundSymbol: FirBasedSymbol<*>?) {
        boundSymbol = newBoundSymbol
    }

    override fun replaceContextReceiverNumber(newContextReceiverNumber: Int) {
        contextReceiverNumber = newContextReceiverNumber
    }

    override fun replaceDiagnostic(newDiagnostic: ConeDiagnostic?) {

Response:
diagnostic = newDiagnostic
    }
}<|endoftext|>


Prompt:
package androidx.compose.compiler.plugins.kotlin.lower

import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.declarations.IrClass

/**
 * Used with K1 only.
 */

Response:
class ClassStabilityInferredCollection {

    private val classesToValues = mutableMapOf<ClassDescriptor, Int>()

    @OptIn(ObsoleteDescriptorBasedAPI::class)
    fun addClass(c: IrClass, stabilityInferredParametersValue: Int) {
        classesToValues[c.descriptor] = stabilityInferredParametersValue
    }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.analysis.project.structure.builder.buildProjectStructureProvider
import org.jetbrains.kotlin.analysis.project.structure.impl.KtSourceModuleImpl
import org.jetbrains.kotlin.analysis.project.structure.impl.buildKtModuleProviderByCompilerConfiguration

Response:
import org.jetbrains.kotlin.analysis.project.structure.impl.getPsiFilesFromPaths
import org.jetbrains.kotlin.analysis.project.structure.impl.getSourceFilePaths
import org.jetbrains.kotlin.analysis.providers.*
import org.jetbrains.kotlin.analysis.providers.impl.*<|endoftext|>


Prompt:
override fun check(declaration: FirFile, context: CheckerContext, reporter: DiagnosticReporter) {
        val topLevelProperties = declaration.declarations.filterIsInstance<FirProperty>()
        checkFileLikeDeclaration(declaration, topLevelProperties, context, reporter)
    }
}

object FirScriptPropertiesChecker : FirScriptChecker(MppCheckerKind.Common) {

Response:
override fun check(declaration: FirScript, context: CheckerContext, reporter: DiagnosticReporter) {
        val topLevelProperties = declaration.declarations.filterIsInstance<FirProperty>()
        checkFileLikeDeclaration(declaration, topLevelProperties, context, reporter)
    }
}

private fun checkFileLikeDeclaration(
    declaration: FirDeclaration,<|endoftext|>


Prompt:
diagnostic: Diagnostic,
        module: TestModule,
        file: TestFile,
        configuration: DiagnosticsRenderingConfiguration,
        withNewInferenceModeEnabled: Boolean
    ) {
        globalMetadataInfoHandler.addMetadataInfosForFile(
            file,
            diagnostic.toMetaInfo(
                module,
                file,
                configuration.withNewInference,

Response:
withNewInferenceModeEnabled
            )
        )
    }

    private fun Diagnostic.toMetaInfo(
        module: TestModule,
        file: TestFile,
        newInferenceEnabled: Boolean,
        withNewInferenceModeEnabled: Boolean
    ): List<DiagnosticCodeMetaInfo> = textRanges.map { range -><|endoftext|>


Prompt:
return originalTypeParameter.isReified
    }

    @OptIn(TypeRefinement::class)
    override fun KotlinTypeMarker.refineType(): KotlinTypeMarker {
        require(this is KotlinType)
        return kotlinTypeRefiner.refineType(this)
    }

Response:
override fun createArgumentConstraintPosition(argument: PostponedAtomWithRevisableExpectedType): ArgumentConstraintPosition<*> {
        require(argument is ResolvedAtom)
        return ArgumentConstraintPositionImpl(argument.atom as KotlinCallArgument)
    }<|endoftext|>


Prompt:
val f: Array<String> = <!ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT!>arrayOf(mutable)<!>,
        val g: Array<String> = <!ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT!>arrayOf(mutableWithGetter)<!>,

Response:
val h: Array<KClass<*>> = <!ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT!>arrayOf(WithLateinit.kClass)<!>
)

const val ONE = 1

val twoWithGetter
    get() = 2

val readOnly = ""

val withGetter
    get() = ""

fun func() = ""<|endoftext|>


Prompt:
package aa

fun <T, R> foo(block: (T)-> R) = block

fun test1() {
    <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!> {
        <!CANNOT_INFER_PARAMETER_TYPE!>x<!> ->  // here we have 'cannot infer parameter type' error
        43
    }

Response:
}

fun bar(f: (<!UNRESOLVED_REFERENCE!>A<!>)->Unit) {}

fun test2() {
    bar { <!CANNOT_INFER_PARAMETER_TYPE!>a<!> -> } // here we don't have 'cannot infer parameter type' error
}<|endoftext|>


Prompt:
package kotlin.js

/**
 * Exports top-level declaration on JS platform.
 *
 * Can only be applied to top-level functions.
 */
@ExperimentalJsExport
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.FUNCTION)
// All targets from expect can't be set because for K/Wasm so far you can export only functions

Response:
@Suppress("ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT")
public actual annotation class JsExport {
    @ExperimentalJsExport
    @Retention(AnnotationRetention.BINARY)
    @Target(
        AnnotationTarget.CLASS,
        AnnotationTarget.FUNCTION,
        AnnotationTarget.PROPERTY,
        AnnotationTarget.CONSTRUCTOR,
    )<|endoftext|>


Prompt:
return expression.value.maybeOptimizeIntoSwitch(context) { jsAssignment(dest, it()).withSource(expression, context).makeStmt() }
    }

    override fun visitSetValue(expression: IrSetValue, context: JsGenerationContext): JsStatement {
        val owner = expression.symbol.owner

Response:
val ref = JsNameRef(context.getNameForValueDeclaration(owner))
        return expression.value.maybeOptimizeIntoSwitch(context) { jsAssignment(ref, it()).withSource(expression, context).makeStmt() }
    }

    override fun visitReturn(expression: IrReturn, context: JsGenerationContext): JsStatement {<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>x.x<!>.funNullableT()
            <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>x.x<!>.funNullableAny()
        }
        if (x.y != null) {

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


Prompt:
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: String) = ModAndRemAssign()
    <!DEPRECATED_BINARY_MOD!>operator<!> fun modAssign(x: String) {}
    operator fun remAssign(x: Int) {}
}

Response:
<!DEPRECATED_BINARY_MOD!>operator<!> fun ModAndRemAssign.mod(x: String) = ModAndRemAssign()
<!DEPRECATED_BINARY_MOD!>operator<!> fun ModAndRemAssign.modAssign(x: String) {}

fun test() {
    val modAndRemAssign = ModAndRemAssign()<|endoftext|>


Prompt:
package org.jetbrains.kotlin.fir.scopes.impl

import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.utils.modality

Response:
import org.jetbrains.kotlin.fir.scopes.FirOverrideChecker
import org.jetbrains.kotlin.fir.scopes.FirTypeScope
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol<|endoftext|>


Prompt:
* DESCRIPTION: Check for lack of unreachable code report when in complex control flow of contract function lambda not all branches are doing non-local return
 * HELPERS: contractFunctions
 */

// TESTCASE NUMBER: 1
fun case_1(b: Boolean?, c: Boolean) {
    funWithExactlyOnceCallsInPlace {
        if (b == null) return

        try {

Response:
<!DEBUG_INFO_IMPLICIT_EXHAUSTIVE!>when (<!DEBUG_INFO_SMARTCAST!>b<!>) {
                true -> {
                    println(1)
                    return
                }
                false -> {
                    println(2)
                    throw Exception()
                }
            }<!>
        } catch (e: Exception) {
            if (c) {<|endoftext|>


Prompt:
// Error(ish): file package does not match file path.
                    // This could happen if, e.g., src/my/pkg/MyTest.java has package `test.pkg`.
                    // It is just best practice, not enforced by language spec.
                    // So, here, we just stop iterating upward the folder structure.
                    break
                }
            }
            javaDir?.let { result += it }
        }

Response:
return result.toList()
    }

    fun getAllBinaryRoots(
        modules: List<KtModule>,
        environment: KotlinCoreProjectEnvironment,
    ): List<JavaRoot> = withAllTransitiveDependencies(modules)
        .filterIsInstance<KtBinaryModule>()
        .flatMap { it.getJavaRoots(environment) }<|endoftext|>


Prompt:
): OverloadResolutionResults<FunctionDescriptor> {
        val propertyHasReceiver = propertyDescriptor.dispatchReceiverParameter != null
        val arguments = KtPsiFactory(delegateExpression.project, markGenerated = false).run {
            listOf(
                createExpression(if (propertyHasReceiver) "this" else "null"),
                createExpressionForProperty()
            )
        }

Response:
val functionName = OperatorNameConventions.PROVIDE_DELEGATE
        val receiver = ExpressionReceiver.create(delegateExpression, delegateExpressionType, context.trace.bindingContext)

        val (provideDelegateCall, provideDelegateResults) =
            fakeCallResolver.makeAndResolveFakeCallInContext(receiver, context, arguments, functionName, delegateExpression)<|endoftext|>


Prompt:
public class PublicClassPrivateMembers private constructor(private val property: String) {
    private fun function(): String = ""
    private class NestedClass
}
internal class InternalClass(val property: String) {
    fun function(): String = ""
    class NestedClass
}
@PublishedApi internal class InternalPAClass(val property: String) {
    fun function(): String = ""
    class NestedClass
}

Response:
@PublishedApi internal class InternalPAClassInternalMembers internal constructor(internal val property: String) {
    internal fun function(): String = ""
    internal class NestedClass
}
@PublishedApi internal class InternalPAClassInternalPAMembers @PublishedApi internal constructor(@PublishedApi internal val property: String) {
    @PublishedApi internal fun function(): String = ""
    @PublishedApi internal class NestedClass
}<|endoftext|>


Prompt:
* This list has size of `groupCount + 1` where `groupCount` is the count of groups in the regular expression.
     * Groups are indexed from 1 to `groupCount` and group with the index 0 corresponds to the entire match.
     *
     * If the group in the regular expression is optional and there were no match captured by that group,
     * corresponding item in [groupValues] is an empty string.
     *

Response:
* @sample samples.text.Regexps.matchDestructuringToGroupValues
     */
    public val groupValues: List<String>

    /**
     * An instance of [MatchResult.Destructured] wrapper providing components for destructuring assignment of group values.
     *
     * component1 corresponds to the value of the first group, component2 — of the second, and so on.
     *<|endoftext|>


Prompt: val NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN: KtDiagnosticFactory1<ConeKotlinType> by error1<KtElement, ConeKotlinType>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)

Response: val NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER: KtDiagnosticFactory1<String> by error1<KtElement, String>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)<|endoftext|>


Prompt:
fun testReceiverLambda2() {
        codegen(
            """
                class DensityScope(val density: Density)

                class Density

                val LocalDensity = compositionLocalOf<Density> { TODO() }

                @Composable
                fun compositionLocalDensity() = LocalDensity.current

                @Composable

Response:
fun WithDensity(block: @Composable DensityScope.() -> Unit) {
                    DensityScope(compositionLocalDensity()).block()
                }
            """
        )
    }

    @Test
    fun testInlineChildren() {
        codegen(
            """
                import androidx.compose.runtime.*

                @Composable
                inline fun PointerInputWrapper(<|endoftext|>


Prompt:
}
        }
    }

    private fun checkDelegation(declaration: KtDeclaration, descriptor: DeclarationDescriptor, diagnosticHolder: DiagnosticSink) {
        if (descriptor !is MemberDescriptor || !descriptor.isEffectivelyExternal()) return

        if (declaration is KtClassOrObject) {

Response:
for (superTypeEntry in declaration.superTypeListEntries) {
                when (superTypeEntry) {
                    is KtSuperTypeCallEntry -> {
                        diagnosticHolder.report(ErrorsJs.EXTERNAL_DELEGATED_CONSTRUCTOR_CALL.on(superTypeEntry.valueArgumentList!!))
                    }
                    is KtDelegatedSuperTypeEntry -> {<|endoftext|>


Prompt:
package org.jetbrains.kotlin.asJava.classes

import com.intellij.psi.PsiModifierListOwner
import com.intellij.psi.PsiPrimitiveType
import com.intellij.psi.PsiType
import org.jetbrains.kotlin.load.java.JvmAnnotationNames

Response:
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeUtils
import org.jetbrains.kotlin.types.isError
import org.jetbrains.kotlin.types.typeUtil.TypeNullability<|endoftext|>


Prompt:
if (check(1, { it as Byte }) != "OK") return "fail 2"
    if (check(1, { it as Short }) != "OK") return "fail 3"
    if (check(1, { it as Long }) != "OK") return "fail 4"
    if (check(1, { it as Char }) != "OK") return "fail 5"

Response:
if (check(1, { it as Double }) != "OK") return "fail 6"
    if (check(1, { it as Float }) != "OK") return "fail 7"

    if (check(1.0, { it as Int }) != "OK") return "fail 11"
    if (check(1.0, { it as Byte }) != "OK") return "fail 12"<|endoftext|>


Prompt:
val info = Project3.serializer().descriptor.annotations.filterIsInstance<MySerializableWithInfo>().first()
    assertEquals(123, info.value)
    assertEquals(String::class, info.kclass)
}

fun testCustomSerializerAndMetaAnnotation() {
    val string = Json.encodeToString(Project4.serializer(), Project4("name", "lang"))

Response:
assertEquals("""name:lang""", string)

    val reconstructed = Json.decodeFromString(Project4.serializer(), string)
    assertEquals("name", reconstructed.name)
    assertEquals("lang", reconstructed.language)
}

fun testSealed() {
    val serializerA = TestSealed.A.serializer()<|endoftext|>


Prompt:
lastSuspension = x
        COROUTINE_SUSPENDED
    }

    fun hasNext() = lastSuspension != null
    fun next() {
        val x = lastSuspension!!
        lastSuspension = null
        x.resume("56")
    }
}

fun builder(c: suspend Controller.() -> Unit) {
    val controller1 = Controller()

Response:
val controller2 = Controller()

    c.startCoroutine(controller1, EmptyContinuation)
    c.startCoroutine(controller2, EmptyContinuation)

    runControllers(controller1, controller2)
}

// TODO: additional parameters are not supported yet
//fun builder2(coroutine c: Controller.(Long, String) -> Continuation<Unit>) {
//    val controller1 = Controller()<|endoftext|>


Prompt:
var onerror: ((Event) -> dynamic)?
    open val title: String
    open val dir: NotificationDirection
    open val lang: String
    open val body: String
    open val tag: String
    open val image: String
    open val icon: String
    open val badge: String
    open val sound: String
    open val vibrate: Array<out Int>
    open val timestamp: Number

Response:
open val renotify: Boolean
    open val silent: Boolean
    open val noscreen: Boolean
    open val requireInteraction: Boolean
    open val sticky: Boolean
    open val data: Any?
    open val actions: Array<out NotificationAction>
    fun close()

    companion object {
        val permission: NotificationPermission
        val maxActions: Int<|endoftext|>


Prompt:
|| lock.write { cacheCursor < cache.size || sequenceIterator.hasNext() }

        override fun next(): T {
            lock.read {
                if (cacheCursor < cache.size) return cache[cacheCursor++]
            }
            // lock.write is not an upgrade but retake, therefore - one more check needed
            lock.write {

Response:
return if (cacheCursor < cache.size) cache[cacheCursor++]
                else sequenceIterator.next().also { cache.add(it) }
            }
        }
    }

    override fun iterator(): Iterator<T> = CachingIterator()
}<|endoftext|>


Prompt:
// WITH_STDLIB
// DIAGNOSTICS: -DEBUG_INFO_SMARTCAST

fun <R> materialize(): R = null!!

fun test1(i : Int, x: Any) {
    require(x is String)
    do {
        x.length
    } while (i < 10)
}

//Assignment after smartcast

fun test2(i : Int) {

Response:
var x: Any? = materialize()
    require(x is String)
    do {
        x.<!UNRESOLVED_REFERENCE!>length<!>
        x = 10
    } while (i < 10)
}

fun test3(i : Int) {
    var x: Any? = materialize()
    require(x is String)
    do {<|endoftext|>


Prompt:
CirRegularTypeProjection(resultingVariance, substitutedType)
            }
        }
    }

    private fun expandTypeAliasType(
        expansion: CirTypeAliasExpansion,
        type: CirProvided.TypeAliasType
    ): CirTypeAliasType {
        val typeAlias: CirProvided.TypeAlias = expansion.typeResolver.resolveClassifier(type.classifierId)

Response:
checkArgumentsCount(typeAlias, type.classifierId, type.arguments)

        val expandedArguments = type.arguments.compactMapIndexed { index, argument ->
            val projection = expandTypeProjection(expansion, argument, typeAlias.typeParameters[index].variance)
            makeNullableTypeIfNecessary(projection, argument)
        }<|endoftext|>


Prompt:
assertEquals(3, bar.foos[1].value)

            bar.one = "Bar"
            bar.foos[0].value = 100
            bar.foos[1].value = 200

            assertEquals("Bar", bar.one)
            assertEquals(100, bar.foos[0].value)
            assertEquals(200, bar.foos[1].value)

Response:
}

        assertEquals("Foo", bar.one)
        assertEquals(1, bar.foos[0].value)
        assertEquals(2, bar.foos[1].value)
        assert(bar.foos[0] === foo0)
        assert(bar.foos[1] === foo1)
    }

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


Prompt:
val librarySrc = FileUtil.findFilesByMask(JAVA_FILES, File(testDataDirectory, "library"))
        val libraryOut = File(tmpdir, "out")
        KotlinTestUtils.compileJavaFilesExternallyWithJava11(librarySrc, listOf("-d", libraryOut.path))

        val libraryOut11 = File(tmpdir, "out11")

Response:
libraryOut11.mkdirs()
        File(libraryOut, "module-info.class").renameTo(File(libraryOut11, "module-info.class"))

        for (version in listOf(9, 10, 11)) {
            try {
                // Use the name other from 'library' to prevent it from being loaded as an automatic module if module-info.class is not found.<|endoftext|>


Prompt:
}) { source, target ->
            source.copyToIgnoringExistingDirectory(target, followLinks = false)
            if (source.name == "3" || source.name == "9.txt") throw IllegalArgumentException()
            CopyActionResult.CONTINUE
        }

        // either "3" or "9.txt" is not copied

Response:
val copied3 = dst.resolve("1/3").exists()
        val copied9 = dst.resolve("8/9.txt").exists()
        assertTrue(copied3 || copied9)
        assertFalse(copied3 && copied9)
    }

    @Test
    fun copyIntoSourceDirectory() {
        val source = createTestFiles().cleanupRecursively()<|endoftext|>


Prompt:
return providers.flatMapToNullableSet { it.getTopLevelCallableNamesInPackage(packageFqName) }
    }

    override val mayHaveSyntheticFunctionTypes: Boolean = providers.any { it.mayHaveSyntheticFunctionTypes }

Response:
override fun mayHaveSyntheticFunctionType(classId: ClassId): Boolean = providers.any { it.mayHaveSyntheticFunctionType(classId) }

    companion object {
        fun create(providers: List<FirSymbolNamesProvider>): FirSymbolNamesProvider = when (providers.size) {
            0 -> FirEmptySymbolNamesProvider
            1 -> providers.single()<|endoftext|>


Prompt:
override fun getContainingDeclaration(): PackageViewDescriptor? = null
        override fun getOriginal() = throw UnsupportedOperationException()
        override fun acceptVoid(visitor: DeclarationDescriptorVisitor<Void, Void>?) = throw UnsupportedOperationException()
        override fun getName() = throw UnsupportedOperationException()
        override val annotations: Annotations
            get() = throw UnsupportedOperationException()

Response:
}

    private class ScopeWithClassifiers(classifiers: List<ClassifierDescriptor>) : MemberScopeImpl() {
        private val classifierMap = HashMap<Name, ClassifierDescriptor>()

        init {
            for (classifier in classifiers) {
                classifierMap.put(classifier.name, classifier)?.let {
                    throw IllegalStateException(
                        String.format(<|endoftext|>


Prompt: String")!>get(0)<!>, 0f, <!STUB_TYPE_IN_ARGUMENT_CAUSES_AMBIGUITY("String; E; String")!>get(0)<!>)

Response:
}

    val list17 = buildList l1@ {
        add("one")

        with (get(0)) {<|endoftext|>


Prompt:
import org.jetbrains.kotlinx.serialization.compiler.resolve.SerialEntityNames.SINGLE_MASK_FIELD_MISSING_FUNC_NAME
import org.jetbrains.org.objectweb.asm.Label
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type

Response:
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter

class SerializableCodegenImpl(
    private val classCodegen: ImplementationBodyCodegen
) : SerializableCodegen(classCodegen.descriptor, classCodegen.bindingContext) {

    private val thisAsmType = classCodegen.typeMapper.mapClass(serializableDescriptor)<|endoftext|>


Prompt:
override fun updateComplementaryFiles(dirtyFiles: Collection<File>, expectActualTracker: ExpectActualTrackerImpl) {
        dirtyFiles.forEach {
            complementaryFilesMap.remove(it)
        }

        val actualToExpect = hashMapOf<File, MutableSet<File>>()
        for ((expect, actuals) in expectActualTracker.expectToActualMap) {

Response:
for (actual in actuals) {
                actualToExpect.getOrPut(actual) { hashSetOf() }.add(expect)
            }
            complementaryFilesMap[expect] = actuals.union(complementaryFilesMap[expect].orEmpty())
        }

        for ((actual, expects) in actualToExpect) {<|endoftext|>


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

package org.jetbrains.<!ELEMENT(1)!>

open class A {
    companion object <!ELEMENT(2)!> {

    }
}

class B {
    companion object <!ELEMENT(3)!>: A() {

    }
}

fun box(): String? {

Response:
if (!checkCompanionObjectName(A::class, "org.jetbrains.<!ELEMENT_VALIDATION(1)!>.A.<!ELEMENT_VALIDATION(2)!>")) return null
    if (!checkCompanionObjectName(B::class, "org.jetbrains.<!ELEMENT_VALIDATION(1)!>.B.<!ELEMENT_VALIDATION(3)!>")) return null<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.propNullableAny
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.funT()

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.funAny()
        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.funNullableT()<|endoftext|>


Prompt:
val file = declaration.getPackageFragment() as? IrFile ?: return null
    return createCompilerMessageLocation(file, startOffset, endOffset)
}

private fun createCompilerMessageLocation(containingFile: IrFile, startOffset: Int, endOffset: Int): CompilerMessageLocation? {
    val sourceRangeInfo = containingFile.fileEntry.getSourceRangeInfo(startOffset, endOffset)

Response:
return CompilerMessageLocation.create(
            path = sourceRangeInfo.filePath,
            line = sourceRangeInfo.startLineNumber + 1,
            column = sourceRangeInfo.startColumnNumber + 1,
            lineContent = null // TODO: retrieve the line content.
    )
}<|endoftext|>


Prompt:
constructor(arg1: UserKlass = UserKlass(), arg2: UserKlass = UserKlass())
    }

    enum class EnumerationCCC {
        ENTRY1,
        ENTRY2();

        constructor(arg1: UserKlass = UserKlass(), arg2: UserKlass = UserKlass())
    }

    enum class EnumerationCCD {
        ENTRY1 {

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

        constructor(arg1: UserKlass = UserKlass(), arg2: UserKlass = UserKlass())

        abstract fun abstractFunc()
    }<|endoftext|>


Prompt:
}
                    if (member.name in failedToResolveUnionTypes) {
                        failedToResolveUnionTypes += unionType.name
                        return
                    }
                    newDependenciesToAdd.putIfAbsent(member.name, mutableSetOf())
                    newDependenciesToAdd[member.name]!!.add(IDLSingleTypeDeclaration(
                            name = unionType.name,

Response:
typeParameter = null,
                            nullable = false
                        ))
                }
                is IDLSingleTypeDeclaration -> {
                    if (member.typeParameter != null || !sourceSet.containsType(member.name)) {
                        failedToResolveUnionTypes += unionType.name
                        return
                    }
                    newDependenciesToAdd.putIfAbsent(member.name, mutableSetOf())<|endoftext|>


Prompt:
// JVM_ABI_K1_K2_DIFF: KT-63864
// WITH_STDLIB
// MODULE: lib
// FILE: lib.kt

package a

import kotlin.reflect.KProperty

public val sb = StringBuilder()

open class A {
    open val x = 42
}

class Delegate {
    val f = 117

Response:
operator fun getValue(receiver: Any?, p: KProperty<*>): Int {
        sb.appendLine(p.name)
        return f
    }
}

open class B: A() {
    override val x: Int by Delegate()

    fun bar() {
        sb.appendLine(super<A>.x)
    }
}

// MODULE: main(lib)<|endoftext|>


Prompt:
fun <V> myRun(f: () -> V): V = f()

fun <S> test1(a: ParameterizedChild<S>?, b: Child): Base<S> = myRun {
    elvis(a, b)
}

fun <S> test2(a: S?, b: S): S = myRun {

Response:
<!ARGUMENT_TYPE_MISMATCH!>select(a, b)<!>
}<|endoftext|>


Prompt:
// `org.jetbrains.kotlin.idea.highlighting.highlighters.ExpressionsSmartcastHighlighter#highlightExpression`
    // function in intellij.git
    private fun KtSourceElement.isSourceForSmartCasts(fir: FirElement) =

Response:
(kind is KtFakeSourceElementKind.SmartCastExpression) && fir is FirSmartCastExpression && !fir.originalExpression.isImplicitThisReceiver

    private val FirExpression.isImplicitThisReceiver get() = this is FirThisReceiverExpression && this.isImplicit

    private fun FirElement.isReadInCompoundCall(): Boolean {<|endoftext|>


Prompt:
import com.intellij.psi.PsiElementFinder
import com.intellij.psi.PsiFileFactory
import com.intellij.psi.PsiPackageStatement
import com.intellij.psi.impl.PsiFileFactoryImpl
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.testFramework.LightVirtualFile

Response:
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
import org.jetbrains.kotlin.cli.jvm.compiler.*
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl
import org.jetbrains.kotlin.fir.expressions.builder.buildEmptyExpressionBlock
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol

Response:
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirValueParameterSymbol
import org.jetbrains.kotlin.fir.types.ConeTypeProjection
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef<|endoftext|>


Prompt:
const val a = 100
    const val b = <!EVALUATED: `Value in a: 100`!>concat("Value in a: ", a)<!>

    val nonConst = { "Not const field in compile time object" }()

    fun concat(first: String, second: Any) = "$first$second"
}

Response:
const val numStatic = <!EVALUATED: `-10`!>A.static<!>
const val numStaticFromFun = <!EVALUATED: `2147483647`!>A.getStaticNumber()<!>
const val valFromObject = <!EVALUATED: `Value in a: 100`!>ObjectWithConst.b<!><|endoftext|>


Prompt:
package kotlin.script.experimental.jvmhost.repl

import org.jetbrains.kotlin.cli.common.repl.*
import org.jetbrains.kotlin.cli.common.repl.ReplEvaluator
import java.util.concurrent.locks.ReentrantReadWriteLock
import kotlin.concurrent.write
import kotlin.reflect.KClass

Response:
import kotlin.script.experimental.api.*
import kotlin.script.experimental.impl.internalScriptingRunSuspend
import kotlin.script.experimental.jvm.BasicJvmScriptEvaluator
import kotlin.script.experimental.jvm.baseClassLoader
import kotlin.script.experimental.jvm.impl.KJvmCompiledScript<|endoftext|>


Prompt:
final var z: Int = 42
        internal set
}
abstract class WithVarProtectedSet {
    abstract var x: Int
        protected set
    open var y: Int = 42
        protected set
    final var z: Int = 42
        protected set
}
abstract class WithVarPrivateSet {
    abstract var x: Int

Response:
<!PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY!>private<!> set
    open var y: Int = 42
        <!PRIVATE_SETTER_FOR_OPEN_PROPERTY!>private<!> set
    final var z: Int = 42
        private set
}

interface IVal {
    val x: Int
    val y: Int<|endoftext|>


Prompt:
if (target is KotlinNativeTarget) {
        attributes.setAttribute(KotlinNativeTarget.konanTargetAttribute, target.konanTarget.name)
    }
    return this
}

private fun HasAttributes.setJavaTargetEnvironmentAttributeIfSupported(project: Project, value: String) {
    if (GradleVersion.current() >= GradleVersion.version("7.0")) {

Response:
attributes.setAttribute(
            TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
            project.objects.named(value)
        )
    }
}

internal val Project.commonKotlinPluginClasspath get() = configurations.getByName(PLUGIN_CLASSPATH_CONFIGURATION_NAME)<|endoftext|>


Prompt:
interface StringList : List<String>

fun box(): String {
    assertEquals(
            listOf(String::class, Int::class),
            D::class.allSupertypes.single { it.classifier == A::class }.arguments.map { it.type!!.classifier }
    )

Response:
val collectionType = StringList::class.allSupertypes.single { it.classifier == Collection::class }
    val arg = collectionType.arguments.single().type!!
    // TODO: this does not work currently because for some reason two different instances of TypeParameterDescriptor are created for List
    // assertEquals(String::class, arg.classifier)

    return "OK"
}<|endoftext|>


Prompt:
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
@kotlin.internal.InlineOnly
public inline operator fun CSSRuleList.get(index: Int): CSSRule? = asDynamic()[index]

/**
 * Exposes the JavaScript [CSSRule](https://developer.mozilla.org/en/docs/Web/API/CSSRule) to Kotlin
 */

Response:
public external abstract class CSSRule {
    open val type: Short
    open var cssText: String
    open val parentRule: CSSRule?
    open val parentStyleSheet: CSSStyleSheet?

    companion object {
        val STYLE_RULE: Short
        val CHARSET_RULE: Short
        val IMPORT_RULE: Short
        val MEDIA_RULE: Short<|endoftext|>


Prompt: expectFailure(linkage("Constructor 'InterfaceToAbstractClassAndAbstractClassImpl.<init>' can not be called: Class 'InterfaceToAbstractClassAndAbstractClassImpl' simultaneously inherits from 2 classes: 'AbstractClass', 'InterfaceToAbstractClass1'")) { getInterfaceToAbstractClassAndAbstractClassImplAsAny() }

Response: expectFailure(linkage("Constructor 'InterfaceToAbstractClassAndAbstractClassImpl.<init>' can not be called: Class 'InterfaceToAbstractClassAndAbstractClassImpl' simultaneously inherits from 2 classes: 'AbstractClass', 'InterfaceToAbstractClass1'")) { getInterfaceToAbstractClassAndAbstractClassImplAsAnyInline() }<|endoftext|>


Prompt:
subType: SimpleTypeMarker,
        superType: SimpleTypeMarker
    ): Boolean? = with(state.typeSystemContext) {
        if (!subType.isIntegerLiteralType() && !superType.isIntegerLiteralType()) return null

Response:
fun isTypeInIntegerLiteralType(integerLiteralType: SimpleTypeMarker, type: SimpleTypeMarker, checkSupertypes: Boolean): Boolean =
            integerLiteralType.possibleIntegerTypes().any { possibleType ->
                (possibleType.typeConstructor() == type.typeConstructor()) || (checkSupertypes && isSubtypeOf(state, type, possibleType))
            }<|endoftext|>


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

    val longList = mutableListOf<Long>()
    val longProgression = 1L..6L
    for (i in longProgression step 2L step 1L) {
        longList += i
    }

Response:
assertEquals(listOf(1L, 2L, 3L, 4L, 5L), longList)

    val charList = mutableListOf<Char>()
    val charProgression = 'a'..'f'
    for (i in charProgression step 2 step 1) {
        charList += i
    }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.psi.KtWhenEntry
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.isError

Response:
import org.jetbrains.kotlin.types.typeUtil.isUnit

fun LookupTracker.record(expression: KtExpression, type: KotlinType) {
    if (type.isError || type.isUnit()) return

    val typeDescriptor = type.constructor.declarationDescriptor ?: return
    val scopeDescriptor = typeDescriptor.containingDeclaration<|endoftext|>


Prompt:
val element0 = '0'
val element1 = '1'
val element2 = '2'
val element3 = '3'
val element4 = '4'

fun box(): String {
    testR0xE0()
    testR0xE1()
    testR0xE2()
    testR0xE3()
    testR0xE4()

Response:
testR1xE0()
    testR1xE1()
    testR1xE2()
    testR1xE3()
    testR1xE4()
    return "OK"
}

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


Prompt:
val artifactsView = metadataDependenciesConfiguration.incoming.artifactView { view ->
            view.componentFilter { id -> id in keptOriginalDependencyResolutionIds }
            view.isLenient = true
        }

        return artifactsView.artifacts.mapNotNull { artifact ->
            val moduleId = artifact.id.componentIdentifier as? ModuleComponentIdentifier ?: return@mapNotNull null

Response:
IdeaKotlinResolvedBinaryDependency(
                binaryType = IdeaKotlinBinaryDependency.KOTLIN_COMPILE_BINARY_TYPE,
                classpath = IdeaKotlinClasspath(artifact.file),
                coordinates = IdeaKotlinBinaryCoordinates(moduleId, artifact.variant.capabilities, artifact.variant.attributes)
            )<|endoftext|>


Prompt:
fun vertexAttribPointer(index: Int, size: Int, type: Int, normalized: Boolean, stride: Int, offset: Int)
    fun viewport(x: Int, y: Int, width: Int, height: Int)

    companion object {
        val DEPTH_BUFFER_BIT: Int
        val STENCIL_BUFFER_BIT: Int
        val COLOR_BUFFER_BIT: Int

Response:
val POINTS: Int
        val LINES: Int
        val LINE_LOOP: Int
        val LINE_STRIP: Int
        val TRIANGLES: Int
        val TRIANGLE_STRIP: Int
        val TRIANGLE_FAN: Int
        val ZERO: Int
        val ONE: Int
        val SRC_COLOR: Int
        val ONE_MINUS_SRC_COLOR: Int<|endoftext|>


Prompt:
//        "⥴" to 10612,
//        "⤖" to 10518,
//        "↣" to 8611,
//        "↝" to 8605,
//        "⤚" to 10522,
//        "⤜" to 10524,
//        "∶" to 8758,

Response:
//        "ℚ" to 8474,
//        "⤍" to 10509,
//        "⤏" to 10511,
//        "⤐" to 10512,
//        "❳" to 10099,
//        "}" to 125,
//        "]" to 93,
//        "⦌" to 10636,<|endoftext|>


Prompt:
* Returns a progression from this value down to the specified [to] value with the step -1.
 *
 * The [to] value should be less than or equal to `this` value.
 * If the [to] value is greater than `this` value the returned progression is empty.
 */
public infix fun Short.downTo(to: Long): LongProgression {

Response:
return LongProgression.fromClosedRange(this.toLong(), to, -1L)
}

/**
 * Returns a progression from this value down to the specified [to] value with the step -1.
 *
 * The [to] value should be less than or equal to `this` value.
 * If the [to] value is greater than `this` value the returned progression is empty.
 */<|endoftext|>


Prompt:
// !LANGUAGE: +StrictJavaNullabilityAssertions
// TARGET_BACKEND: JVM
// WITH_STDLIB
// JVM_TARGET: 1.8

// FILE: box.kt
import kotlin.test.*

fun box(): String {
    val actualValues = mutableListOf<Int>()
    for (i in J.iteratorOfNotNull()) {

Response:
actualValues += i
    }
    assertEquals(listOf(42, -42), actualValues)
    return "OK"
}

// FILE: J.java
import java.util.*;
import org.jetbrains.annotations.*;

public class J {
    public static Iterator<@NotNull Integer> iteratorOfNotNull() {
        List<Integer> list = new ArrayList<>();<|endoftext|>


Prompt:
private var functionReport: MetadataPropertyReport? = null

    override fun isEmpty() = propertyDiffs.isEmpty() && functionReport.isNullOrEmpty()

    override fun writeAsHtml(output: PrintWriter) {
        if (isEmpty()) return
        output.tag("h2", "SYNTHETIC CLASS METADATA $classInternalName")

Response:
functionReport?.run { writeAsHtml(output) }
    }

    fun functionReport() = MetadataPropertyReport("function", header1, header2).also { functionReport = it }

    fun addPropertyDiff(diff: NamedDiffEntry) {
        propertyDiffs.add(diff)
    }

    fun TextTreeBuilderContext.appendSyntheticClassMetadataReport() {<|endoftext|>


Prompt:
fun notOverwriteCustomResDirs(gradleVersion: GradleVersion) {
        project("simpleProject", gradleVersion) {
            val mainResDir = projectPath.resolve("src/main/resources").apply { createDirectories() }
            val mainResFile = mainResDir.resolve("main.txt").apply { writeText("Yay, Kotlin!") }

Response:
val additionalResDir = projectPath.resolve("src/main/extra-resources").apply { createDirectory() }
            val additionalResFile = additionalResDir.resolve("test.txt").apply { writeText("Kotlin!") }

            buildGradle.writeText(
                """
                |plugins {
	            |    id 'java'<|endoftext|>


Prompt:
return "Wrong elements for MaxL..MinL: $list4"
    }

    val list5 = ArrayList<Char>()
    for (i in MaxC..MinC) {
        list5.add(i)
        if (list5.size > 23) break
    }
    if (list5 != listOf<Char>()) {

Response:
return "Wrong elements for MaxC..MinC: $list5"
    }

    return "OK"
}<|endoftext|>


Prompt:
+ (node?.let { "n${ids[it]!!}" } ?: "t${tempIds[this]}")) +
                                "[d=$depth,${if (this in escapeOrigins) "eo" else if (escapes(this)) "e" else ""}]"

                for (from in allNodes) {
                    if (!nodeFilter(from)) continue

Response:
for (it in from.edges) {
                        val to = it.node
                        if (!nodeFilter(to)) continue
                        when (it) {
                            is PointsToGraphEdge.Assignment ->
                                +"    \"${from.format()}\" -> \"${to.format()}\";"
                            is PointsToGraphEdge.Field -><|endoftext|>


Prompt:
package org.jetbrains.kotlin.resolve.calls.inference

import org.jetbrains.kotlin.builtins.*
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.descriptors.annotations.Annotations

Response:
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilderImpl.ConstraintKind.EQUAL
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilderImpl.ConstraintKind.SUB_TYPE
import org.jetbrains.kotlin.resolve.calls.inference.TypeBounds.Bound<|endoftext|>


Prompt:
} finally {
        finallyBlock()
    }
    return res
}

public inline fun <R> doCall2(block: ()-> R, exception: (e: Exception)-> Unit, finallyBlock: ()-> R, res: R) : R {
    try {
        return block()
    } catch (e: Exception) {
        exception(e)
    } finally {
        finallyBlock()

Response:
}
    return res
}

// FILE: 2.kt

import test.*

class Holder {
    var value: String = ""
}

fun test0(h: Holder): Int {
    val localResult = doCall2 (
            {
                h.value += "OK_NONLOCAL"
                if (true) {
                    throw RuntimeException()
                }
                return 1
            },<|endoftext|>


Prompt:
val leftVal = if (left is IrGetValue) left.symbol.owner else irTemporary(left)
                val rightVal = if (right is IrGetValue) right.symbol.owner else irTemporary(right)

                val equalsCall = equals(
                    if (leftNullCheck) irImplicitCast(irGet(leftVal), left.type.makeNotNull()) else irGet(leftVal),

Response:
if (rightNullCheck) irImplicitCast(irGet(rightVal), right.type.makeNotNull()) else irGet(rightVal)
                )

                val equalsRight = if (rightNullCheck) {
                    irIfNull(context.irBuiltIns.booleanType, irGet(rightVal), irFalse(), equalsCall)
                } else {
                    equalsCall
                }<|endoftext|>


Prompt:
* @throws JsonElementTypeMismatchException is current element is not a [JsonObject]
     */
    open val jsonObject: JsonObject
        get() = error("JsonObject")

    /**
     * Convenience method to get current element as [JsonArray]
     * @throws JsonElementTypeMismatchException is current element is not a [JsonArray]
     */

Response:
open val jsonArray: JsonArray
        get() = error("JsonArray")

    /**
     * Convenience method to get current element as [JsonNull]
     * @throws JsonElementTypeMismatchException is current element is not a [JsonNull]
     */
    open val jsonNull: JsonNull
        get() = error("JsonPrimitive")

    /**<|endoftext|>


Prompt:
val builtInsFragments = module.getPackage(packageFqName).fragments.filterIsInstance<BuiltInsPackageFragment>()

        // JS IR backend uses separate FunctionInterfacePackageFragment for function interfaces
        val containingPackageFragment =
            builtInsFragments.filterIsInstance<FunctionInterfacePackageFragment>().firstOrNull() ?: builtInsFragments.first()

Response:
return FunctionClassDescriptor(storageManager, containingPackageFragment, kind, arity)
    }

    override fun getAllContributedClassesIfPossible(packageFqName: FqName): Collection<ClassDescriptor> {
        // We don't want to return 256 classes here since it would cause them to appear in every import list of every file
        // and likely slow down compilation very much
        return emptySet()<|endoftext|>


Prompt:
@kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Long): kotlin.Long { /* compiled code */ }

    @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Short): kotlin.Int { /* compiled code */ }

Response:
public final operator fun rangeTo(other: kotlin.Byte): kotlin.ranges.IntRange { /* compiled code */ }

    public final operator fun rangeTo(other: kotlin.Int): kotlin.ranges.IntRange { /* compiled code */ }

    public final operator fun rangeTo(other: kotlin.Long): kotlin.ranges.LongRange { /* compiled code */ }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.fir.FirElementWithResolveState
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.expressions.FirStatement
import org.jetbrains.kotlin.fir.isCopyCreatedInScope

Response:
import org.jetbrains.kotlin.fir.languageVersionSettings
import org.jetbrains.kotlin.fir.resolve.transformers.mpp.FirExpectActualMatcherTransformer
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase<|endoftext|>


Prompt:
package org.jetbrains.kotlin.incremental.parsing

import com.intellij.openapi.Disposable
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.vfs.StandardFileSystems
import com.intellij.openapi.vfs.VirtualFileManager

Response:
import com.intellij.openapi.vfs.local.CoreLocalFileSystem
import com.intellij.psi.PsiManager
import com.intellij.psi.SingleRootFileViewProvider
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.messages.MessageCollector<|endoftext|>


Prompt:
return commonSystem.fixedTypeVariables as Map<TypeConstructor, UnwrappedType> // TODO: SUB
    }

    private fun getNestedBuilderInferenceSessions() = buildList {
        for (nestedSession in nestedInferenceSessions) {
            when (nestedSession) {
                is BuilderInferenceSession -> add(nestedSession)

Response:
is DelegateInferenceSession -> addAll(nestedSession.getNestedBuilderInferenceSessions())
            }
        }
    }

    /*
     * We update calls in top-down way:
     * - updating calls within top-level builder inference call
     * - ...
     * - updating calls within the deepest builder inference call
     */<|endoftext|>


Prompt:
ExitNodeMarker {
    override fun <R, D> accept(visitor: ControlFlowGraphVisitor<R, D>, data: D): R {
        return visitor.visitTryMainBlockExitNode(this, data)
    }
}
class CatchClauseEnterNode(owner: ControlFlowGraph, override val fir: FirCatch, level: Int) : CFGNode<FirCatch>(owner, level),

Response:
EnterNodeMarker {
    override fun <R, D> accept(visitor: ControlFlowGraphVisitor<R, D>, data: D): R {
        return visitor.visitCatchClauseEnterNode(this, data)
    }
}<|endoftext|>


Prompt:
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER
data class A(val x: Int, val y: String)
data class B(val u: Double, val w: Short)

fun foo(block: (A, B) -> Unit) { }

fun bar() {

Response:
foo { (<!REDECLARATION!>a<!>, <!REDECLARATION!>a<!>), b ->
        a checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Int>() }<|endoftext|>


Prompt:
package org.jetbrains.kotlin.diagnostics

import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersionSettings

Response:
sealed class DiagnosticFactoryForDeprecation<E : PsiElement, D : Diagnostic, F : DiagnosticFactoryWithPsiElement<E, D>>(
    val deprecatingFeature: LanguageFeature,
    val warningFactory: F,
    val errorFactory: F
) {
    fun LanguageVersionSettings.chooseFactory(): F {
        return if (supportsFeature(deprecatingFeature)) errorFactory else warningFactory<|endoftext|>


Prompt:
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmFlags as JF

/**
 * Applicable to a property declared in an interface's companion object.
 * Indicates that its backing field is declared as a static
 * field in the interface. In Kotlin code, this usually happens if the property is annotated with [JvmField].
 *

Response:
* Returns `false` if the property is not declared in a companion object of some interface.
 */
public var KmProperty.isMovedFromInterfaceCompanion: Boolean by BooleanFlagDelegate(
    KmProperty::jvmFlags,
    booleanFlag(JF.IS_MOVED_FROM_INTERFACE_COMPANION)
)

/**<|endoftext|>


Prompt:
import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
import org.jetbrains.kotlin.fir.visitors.transformSingle

Response:
import org.jetbrains.kotlin.resolve.calls.inference.addEqualityConstraintIfCompatible
import org.jetbrains.kotlin.resolve.calls.inference.addSubtypeConstraintIfCompatible
import org.jetbrains.kotlin.resolve.calls.inference.buildAbstractResultingSubstitutor<|endoftext|>


Prompt:
.unsubstitutedMemberScope
            .getDescriptorsFiltered()
            .filter(DescriptorUtils::isEnumEntry)
    }

    override val CallableSymbolMarker.dispatchReceiverType: KotlinTypeMarker?
        get() = asDescriptor().dispatchReceiverParameter?.type

Response:
override val CallableSymbolMarker.extensionReceiverType: KotlinTypeMarker?
        get() = asDescriptor().extensionReceiverParameter?.type
    override val CallableSymbolMarker.returnType: KotlinTypeMarker
        get() = asDescriptor().returnType!!
    override val CallableSymbolMarker.typeParameters: List<TypeParameterSymbolMarker><|endoftext|>


Prompt:
}
                else -> {
                    @OptIn(UnsafeExpressionUtility::class)
                    argument.toResolvedCallableSymbolUnsafe()?.takeIf { it.fir is FirEnumEntry }
                }
            } ?: return
            processBranch(symbol, isNegated, data)
        }

Response:
override fun visitTypeOperatorCall(typeOperatorCall: FirTypeOperatorCall, data: Flags) {
            val isNegated = when (typeOperatorCall.operation) {
                FirOperation.IS -> false
                FirOperation.NOT_IS -> true
                else -> return
            }<|endoftext|>


Prompt:
// when this member is referenced in subclass.
                    if (isStatic)
                        JavaDescriptorVisibilities.PROTECTED_STATIC_VISIBILITY
                    else
                        DescriptorVisibilities.PROTECTED
                }
                else ->
                    target.visibility
            }
            isSuspend = target.isSuspend
        }.apply proxy@{
            parent = this@makeProxy

Response:
copyAttributes(target)
            copyTypeParametersFrom(target)
            copyAnnotationsFrom(target)
            if (!isStatic) {
                dispatchReceiverParameter = thisReceiver?.copyTo(this, type = defaultType)
            }
            extensionReceiverParameter = target.extensionReceiverParameter?.copyTo(this)<|endoftext|>


Prompt:
override fun readWriteAccessWithFullExpressionByResolve(assignment: KtBinaryExpression): Pair<ReferenceAccess, KtExpression> {
        val resolvedCall = analyze(assignment) {
            with((this as KtFe10AnalysisSession).analysisContext.analyze(assignment, Fe10AnalysisFacade.AnalysisMode.PARTIAL)) {

Response:
assignment.getCall(this)?.getResolvedCall(this) ?: return ReferenceAccess.READ_WRITE to assignment
            }
        }
        return if (resolvedCall.resultingDescriptor.name in OperatorConventions.ASSIGNMENT_OPERATIONS.values)
            ReferenceAccess.READ to assignment
        else
            ReferenceAccess.READ_WRITE to assignment
    }
}<|endoftext|>


Prompt:
// Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit!
// WITH_STDLIB
import kotlin.test.*

fun box(): String {
    val uintList = mutableListOf<UInt>()
    val uintProgression = UInt.MIN_VALUE until UInt.MAX_VALUE
    for (i in uintProgression step Int.MAX_VALUE) {
        uintList += i

Response:
}
    assertEquals(listOf(UInt.MIN_VALUE, 2147483647u, UInt.MAX_VALUE - 1u), uintList)

    val ulongList = mutableListOf<ULong>()
    val ulongProgression = ULong.MIN_VALUE until ULong.MAX_VALUE
    for (i in ulongProgression step Long.MAX_VALUE) {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.gradle.dsl.HasConfigurableKotlinCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

Response:
import org.jetbrains.kotlin.gradle.plugin.mpp.external.DecoratedExternalKotlinTarget

data class PrototypeAndroidDsl(
    var compileSdk: Int
)

@OptIn(ExperimentalKotlinGradlePluginApi::class)
class PrototypeAndroidTarget(
    delegate: Delegate,
    val androidDsl: PrototypeAndroidDsl<|endoftext|>


Prompt:
""".trimIndent()
        )

        analyze(file) {
            val foo = file
                .getClassOrFail("PublicA").getMemberScope()
                .getClassOrFail("PrivateB").getMemberScope()
                .getClassOrFail("PublicC")
                .getFunctionOrFail("foo")
            assertFalse(foo.isVisibleInObjC())
        }
    }

Response:
@Test
    fun `test - invisible symbol inside public class marked with @HidesFromObjC`() {
        val file = inlineSourceCodeAnalysis.createKtFile(
            """
                @kotlin.native.HidesFromObjC
                annotation class HideIt

                @HideIt
                class PublicClass {
                    fun foo()
                }
            """.trimIndent()
        )<|endoftext|>


Prompt:
The Default Kotlin Hierarchy Template was not applied to '${project.displayName}':
                Explicit .dependsOn() edges were configured for the following source sets:
                ${sourceSetsWithDependsOnEdges.toSet().map { it.name }}

                Consider removing dependsOn-calls or disabling the default template by adding

Response:
'$KOTLIN_MPP_APPLY_DEFAULT_HIERARCHY_TEMPLATE=false'
                to your gradle.properties

                Learn more about hierarchy templates: https://kotl.in/hierarchy-template
            """.trimIndent()
        )
    }<|endoftext|>


Prompt:
@JvmField
    var myFloatFieldFromConst: Float = constFloat
    @JvmField
    var myBooleanFieldFromConst: Boolean = constBoolean
    @JvmField
    var myCharFieldFromConst: Char = constChar

    @JvmField
    var myIntField: Int = 0
    @JvmField
    var myByteField: Byte = 0
    @JvmField

Response:
var myLongField: Long = 0L
    @JvmField
    var myShortField: Short = 0
    @JvmField
    var myDoubleField: Double = 0.0
    @JvmField
    var myFloatField: Float = 0.0f
    @JvmField
    var myBooleanField: Boolean = false
    @JvmField<|endoftext|>


Prompt:
}
}

internal object CheckCallModifiers : CheckerStage() {
    override suspend fun check(candidate: Candidate, callInfo: CallInfo, sink: CheckerSink, context: ResolutionContext) {
        if (callInfo.callSite is FirFunctionCall) {
            when (val functionSymbol = candidate.symbol) {
                is FirNamedFunctionSymbol -> when {

Response:
callInfo.callSite.origin == FirFunctionCallOrigin.Infix && !functionSymbol.fir.isInfix ->
                        sink.reportDiagnostic(InfixCallOfNonInfixFunction(functionSymbol))
                    callInfo.callSite.origin == FirFunctionCallOrigin.Operator && !functionSymbol.fir.isOperator -><|endoftext|>


Prompt:
computeDescriptors(kindFilter, nameFilter, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS) +
                c.components.fictitiousClassDescriptorFactories.flatMap { it.getAllContributedClassesIfPossible(packageFqName) }

    override fun hasClass(name: Name) =

Response:
super.hasClass(name) || c.components.fictitiousClassDescriptorFactories.any { it.shouldCreateClass(packageFqName, name) }

    override fun createClassId(name: Name) = ClassId(packageFqName, name)

    override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {<|endoftext|>


Prompt:
lastValueAsULong > (constLimitAsULong - stepValueAsLong.toULong())
                }
                else -> error("Unexpected progression direction")
            }
        } else {
            val lastValueAsLong = last.constLongValue ?: return@lazy true  // If "last" is not a const Number or Char.
            when (direction) {
                ProgressionDirection.DECREASING -> {

Response:
val constLimitAsLong = progressionType.minValueAsLong
                    lastValueAsLong < (constLimitAsLong - stepValueAsLong)
                }
                ProgressionDirection.INCREASING -> {
                    val constLimitAsLong = progressionType.maxValueAsLong
                    lastValueAsLong > (constLimitAsLong - stepValueAsLong)
                }
                else -> error("Unexpected progression direction")
            }<|endoftext|>


Prompt:
binaryOperation(INT, BYTE, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }),
        binaryOperation(INT, DOUBLE, "plus", { a, b -> a.plus(b) }, emptyBinaryFun),
        binaryOperation(INT, FLOAT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun),

Response:
binaryOperation(INT, INT, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }),
        binaryOperation(INT, LONG, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }),<|endoftext|>


Prompt:
contract { returns() implies (this@case_3 is Number && this@case_3 is Int && <!SENSELESS_COMPARISON!>this@case_3 != null<!>) }
    if (!(this@case_3 is Number && this@case_3 is Int && <!SENSELESS_COMPARISON!>this@case_3 != null<!>)) throw Exception()
}

Response:
// TESTCASE NUMBER: 4
fun <T> T?.case_4_1(): Boolean {
    contract { returns(true) implies (this@case_4_1 != null && this@case_4_1 is String) }
    return this@case_4_1 != null && this@case_4_1 is String
}
fun <T> T?.case_4_2(): Boolean {<|endoftext|>


Prompt:
if (overwriteOnlyOlderFiles && targetFile.exists() && resource.lastModified() < targetFile.lastModified()) return

        targetFile.parentFile.mkdirs()
        resource.reader().use { input ->
            FileOutputStream(targetFile).use { output ->
                input.copyTo(output)
            }
        }
    }

Response:
private fun mapSourcePaths(inputFile: File, targetFile: File): Boolean {
        val jsonOut = StringWriter()
        val pathCalculator = RelativePathCalculator(targetFile.parentFile)
        val sourceMapChanged = try {
            SourceMap.mapSources(inputFile.readText(), jsonOut) {<|endoftext|>


Prompt:
<!FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS!>fun<!> interface NestedSimple

    fun interface GoodFun {
        fun invoke()
    }

    fun interface NestedFun {
        fun inovke(element: <!UNRESOLVED_REFERENCE!>K<!>)
    }
}

fun <T> local() {

Response:
<!LOCAL_INTERFACE_NOT_ALLOWED!>fun interface LocalFun<!> {
        fun invoke(element: T)
    }
}

fun interface WithDefaultValue {
    fun invoke(<!FUN_INTERFACE_ABSTRACT_METHOD_WITH_DEFAULT_VALUE!>s: String = ""<!>)
}

interface BaseWithDefaultValue {<|endoftext|>


Prompt:
//        val anyValues: List<Any> = values.filterIsInstance<Any>()
//        assertEquals(values.toList(), anyValues)

        val charValues: List<Char> = values.filterIsInstance<Char>()
        assertEquals(0, charValues.size)
    }

    @Test fun filterIsInstanceArray() {

Response:
val src: Array<Any> = arrayOf(1, 2, 3.0, "abc", "cde")

        val numberValues: List<Number> = src.filterIsInstance<Number>()
        assertEquals(listOf(1, 2, 3.0), numberValues)

        // doesn't distinguish double from int in JS<|endoftext|>


Prompt:
public constructor SubclassOptInRequired(markerClass: kotlin.reflect.KClass<out kotlin.Annotation>)

    public final val markerClass: kotlin.reflect.KClass<out kotlin.Annotation> { get; }
}

Response: @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION,<|endoftext|>


Prompt:
package org.jetbrains.kotlin.analysis.decompiled.light.classes.origin

import com.intellij.openapi.application.ApplicationManager
import com.intellij.psi.PsiArrayType
import com.intellij.psi.PsiField
import com.intellij.psi.PsiMember
import com.intellij.psi.PsiMethod

Response:
import com.intellij.psi.PsiParameterList
import com.intellij.psi.PsiPrimitiveType
import com.intellij.psi.PsiType
import org.jetbrains.kotlin.analysis.decompiler.psi.file.KtClsFile<|endoftext|>


Prompt:
return this@AbstractCharClass.contains(ch) && !containslHS
            }
        }
        result.alt = this.alt
        result.altSurrogates = this.altSurrogates
        result.mayContainSupplCodepoints = this.mayContainSupplCodepoints
        return result
    }

    /**

Response:
* Sets this CharClass to negative form, i.e. if they will add some characters and after that set this
     * class to negative it will accept all the characters except previously set ones.
     *
     * Although this method will not alternate all the already set characters,
     * just overall meaning of the class.
     */
    fun setNegative(value: Boolean): AbstractCharClass {
        if (alt xor value) {<|endoftext|>


Prompt:
if (++count == n)
            break
    }
    return list
}

/**
 * Returns a list containing first [n] elements.
 *
 * @throws IllegalArgumentException if [n] is negative.
 *
 * @sample samples.collections.Collections.Transformations.take
 */
public fun LongArray.take(n: Int): List<Long> {

Response:
require(n >= 0) { "Requested element count $n is less than zero." }
    if (n == 0) return emptyList()
    if (n >= size) return toList()
    if (n == 1) return listOf(this[0])
    var count = 0
    val list = ArrayList<Long>(n)
    for (item in this) {
        list.add(item)<|endoftext|>


Prompt:
assertCommandLineArgumentsContain(escapedQuotedPath)
                }
            }
        }
    }

    @DisplayName("Checks binary options dsl")
    @GradleTest
    fun testBinaryOptionsDSL(gradleVersion: GradleVersion) {
        nativeProject("native-binaries/executables", gradleVersion) {
            buildGradleKts.appendText(
                """

Response:
kotlin.targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget::class.java) {
                        binaries.all { binaryOptions["memoryModel"] = "experimental" }
                    }
                """.trimIndent()
            )
            build(":linkDebugExecutableHost") {<|endoftext|>


Prompt:
}

        return builder.build()
    }

    private fun processAnnotation(builder: ImmutableSet.Builder<String>, annotationDescriptor: AnnotationDescriptor) {
        if (annotationDescriptor.fqName != StandardNames.FqNames.suppress) return

        // We only add strings and skip other values to facilitate recovery in presence of erroneous code

Response:
for (arrayValue in annotationDescriptor.allValueArguments.values) {
            if (arrayValue is ArrayValue) {
                for (value in arrayValue.value) {
                    if (value is StringValue) {
                        builder.add(value.value.lowercase())
                    }
                }
            }
        }
    }<|endoftext|>


Prompt:
val classifierName = when {
            kClass == null -> classifier.toString()
            kClass.simpleName != null -> kClass.simpleName
            else -> "(non-denotable type)"
        }

        val args =
            if (arguments.isEmpty()) ""
            else arguments.joinToString(", ", "<", ">")

Response:
val nullable = if (isMarkedNullable) "?" else ""

        return classifierName + args + nullable
    }
}<|endoftext|>


Prompt:
return CompilerMessageLocationWithRange.create(sourceFile.path, startLine, startColumn, endLine, endColumn, text?.toString())
}

private fun FirFile.getLineAndColumnStartingWithOnesAt(offset: Int?): Pair<Int, Int>? {
    return offset?.let { sourceFileLinesMapping?.getLineAndColumnByOffsetStartingWithOnes(it) }
}

Response:
private fun KtSourceFileLinesMapping.getLineAndColumnByOffsetStartingWithOnes(startOffset: Int): Pair<Int, Int> {
    val (line, column) = getLineAndColumnByOffset(startOffset)
    return line + 1 to column + 1
}

fun <PathProvider : Any> getLibraryFromHome(
    paths: PathProvider?,
    getLibrary: (PathProvider) -> File,<|endoftext|>


Prompt:
case313 checkType { check<Char>()}
}
// TESTCASE NUMBER: 314
fun case314(){
   val case314 = '\u9cff'
   <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char")!>case314<!>
   case314 checkType { check<Char>()}
}
// TESTCASE NUMBER: 315
fun case315(){

Response:
val case315 = '\u9d00'
   <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char")!>case315<!>
   case315 checkType { check<Char>()}
}
// TESTCASE NUMBER: 316
fun case316(){
   val case316 = '\u9dff'<|endoftext|>


Prompt:
.filter { it !is IdeaKotlinBinaryDependency }
            .assertMatches(
                dependsOnDependency(":consumer/commonMain"),
                projectArtifactDependency(IdeaKotlinSourceDependency.Type.Regular, ":producer", FilePathRegex(".*producer.jar"))
            )
    }

    @Test

Response:
fun `test - project to jvm (java only) project dependency`() {
        val root = buildProject()

        val producer = buildProject({ withParent(root).withName("producer") }) { plugins.apply(JavaLibraryPlugin::class.java) }
        val consumer = buildProject({ withParent(root).withName("consumer") }) { configureAndroidAndMultiplatform() }<|endoftext|>


Prompt:
println(value_1?.toByte())
        funWithReturns(value_1 is Number)
        println(value_1.toByte())
        if (funWithReturnsNull(value_1 is Int) == null) println(value_1.inv())
    }
}

// TESTCASE NUMBER: 3
fun case_3(value_1: Int?, value_2: Any?) {

Response:
if (!value_1.case_3(value_1, value_2 is Number?)) {
        println(value_2?.toByte())
        println(value_1.inv())
    } else if (value_1.case_3(value_1, value_2 is Number?)) {
        println(value_1)
    } else {
        println(value_1.inv())
    }
}<|endoftext|>


Prompt:
tmpdir, testRootDisposable, jdkKind, ConfigurationKind.ALL, true, false, false, false, null
        ).first

        RecursiveDescriptorComparatorAdaptor.validateAndCompareDescriptors(expected, actual, comparatorConfiguration, null)
    }

    private fun DeclarationDescriptor.isJavaAnnotationConstructor() =
        this is ClassConstructorDescriptor &&

Response:
containingDeclaration is JavaClassDescriptor &&
                containingDeclaration.kind == ClassKind.ANNOTATION_CLASS

    @OptIn(ObsoleteTestInfrastructure::class)
    private fun compileFile(file: File, text: String, jdkKind: TestJdkKind) {
        val fileName = file.name
        when {
            fileName.endsWith(".java") -> {<|endoftext|>


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

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


Prompt:
buildConcatenationCall(plusImplFunction, buildNullableArgToString(extensionReceiver!!), buildNullableArgToString(getValueArgument(0)!!))

                else -> expression
            }
        }
    }

    private fun buildConcatenationCall(function: IrSimpleFunction, receiver: IrExpression, argument: IrExpression): IrExpression =

Response:
builder.irCall(function.symbol, function.returnType, valueArgumentsCount = 1, typeArgumentsCount = 0)
                    .apply {
                        putValueArgument(0, argument)
                        dispatchReceiver = receiver
                    }

    /** Builds snippet of type String<|endoftext|>


Prompt:
fun compare(v: String) = areEqualNumbers(v)

        val zero = when (kind) {
            LONG -> "0L"
            else -> "0"
        }
        val checkZero = """if (step == $zero) throw kotlin.IllegalArgumentException("Step must be non-zero.")"""

        val stepMinValue = "$incrementType.MIN_VALUE"

Response:
val checkMin = """if (step == $stepMinValue) throw kotlin.IllegalArgumentException("Step must be greater than $stepMinValue to avoid overflow on negation.")"""

        val hashCode = "=\n" + when (kind) {
            CHAR ->
                "        if (isEmpty()) -1 else (31 * (31 * first.code + last.code) + step)"
            INT -><|endoftext|>


Prompt:
package org.jetbrains.kotlin.daemon.client

import org.jetbrains.kotlin.daemon.common.*
import org.jetbrains.kotlin.incremental.components.*
import org.jetbrains.kotlin.incremental.js.IncrementalDataProvider
import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumer

Response:
import org.jetbrains.kotlin.incremental.js.JsInlineFunctionHash
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
import org.jetbrains.kotlin.load.kotlin.incremental.components.JvmPackagePartProto
import org.jetbrains.kotlin.modules.TargetId<|endoftext|>


Prompt:
fun clang_Cursor_isMacroBuiltin(C: CValue<CXCursor>): Int {
    memScoped {
        return kniBridge146(C.getPointer(memScope).rawValue)
    }
}

fun clang_Cursor_isFunctionInlined(C: CValue<CXCursor>): Int {
    memScoped {

Response:
return kniBridge147(C.getPointer(memScope).rawValue)
    }
}

fun clang_isVolatileQualifiedType(T: CValue<CXType>): Int {
    memScoped {
        return kniBridge148(T.getPointer(memScope).rawValue)
    }
}<|endoftext|>


Prompt:
// WITH_STDLIB

import Host.x

object A {
    var xx = intArrayOf(0)
}

object Host {
    val A.x get() = A.xx
}

fun box(): String {
    A.x[0] += 1
    if (A.x[0] != 1) return "Fail 1: ${A.x[0]}"

Response:
A.x[0]++
    if (A.x[0] != 2) return "Fail 2: ${A.x[0]}"

    ++A.x[0]
    if (A.x[0] != 3) return "Fail 3: ${A.x[0]}"

    return "OK"
}<|endoftext|>


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

OPTIONAL_JVM_INLINE_ANNOTATION
value class X<T: Any>(val x: T)

interface IFoo {
    fun foo(): Any
    fun bar(): X<String>
}

class TestX : IFoo {

Response:
override fun foo(): X<String> = X("O")
    override fun bar(): X<String> = X("K")
}

fun box(): String {
    val t: IFoo = TestX()
    val tFoo = t.foo()
    if (tFoo !is X<*>) {
        throw AssertionError("X expected: $tFoo")
    }<|endoftext|>


Prompt:
super<AsyncDependenciesResolver>.resolve(scriptContents, environment)
}

@Target(AnnotationTarget.FILE)
annotation class TestAnno1

@Target(AnnotationTarget.FILE)
annotation class TestAnno2

@Target(AnnotationTarget.FILE)
annotation class TestAnno3

Response:
private val annotationFqNames = listOf(TestAnno1::class, TestAnno2::class, TestAnno3::class).map { it.qualifiedName!! }

interface AcceptedAnnotationsCheck {
    fun checkHasAnno1Annotation(scriptContents: ScriptContents): ResolveResult.Success {
        val actualAnnotations = scriptContents.annotations
        Assert.assertTrue(<|endoftext|>


Prompt:
public inline fun <T, K> Array<out T>.associateBy(keySelector: (T) -> K): Map<K, T> {
    val capacity = mapCapacity(size).coerceAtLeast(16)
    return associateByTo(LinkedHashMap<K, T>(capacity), keySelector)
}

/**
 * Returns a [Map] containing the elements from the given array indexed by the key

Response:
* returned from [keySelector] function applied to each element.
 *
 * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
 *
 * The returned map preserves the entry iteration order of the original array.
 *
 * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesBy
 */<|endoftext|>


Prompt:
generateSerializerForType(type, this, intrinsicType)
            }
            descriptor.append(kSerializerArrayType.descriptor)
        }
        descriptor.append(")${kSerializerType.descriptor}")
        invokestatic(
            serializersKtInternalName,
            noCompiledSerializerMethodName,
            descriptor.toString(),
            false

Response:
)
        return false
    }

    private fun InstructionAdapter.moduleOverPolymorphic(serializer: IrClassSymbol, kType: IrType, intrinsicType: IntrinsicType, argSerializers: List<Pair<IrType, IrClassSymbol?>>): Boolean {<|endoftext|>


Prompt:
val receiverExpression = expressionReceiverValue.expression
        val c = context.resolutionContext

        val assertionInfo = RuntimeAssertionInfo.create(
            receiverParameter.type,
            receiverValue.type,
            RuntimeAssertionsDataFlowExtras(c, receiverValue.type, receiverExpression)
        )

        if (assertionInfo != null) {

Response:
c.trace.record(JvmBindingContextSlices.RECEIVER_RUNTIME_ASSERTION_INFO, expressionReceiverValue, assertionInfo)
        }
    }
}

object RuntimeAssertionsOnDeclarationBodyChecker {
    @JvmStatic
    fun check(
        declaration: KtDeclaration,
        descriptor: DeclarationDescriptor,<|endoftext|>


Prompt:
// EXPECTED_REACHABLE_NODES: 1283
package foo

fun factorial(n: Int): Int = js("""
    var result = 1;
    var i = 1;

    while(i <= n) {
        result *= i++;
    }

    return result;
""")

fun box(): String {
    assertEquals(24, factorial(4))

Response:
assertEquals(120, factorial(5))

    return "OK"
}<|endoftext|>


Prompt:
val DOCUMENT_NODE: Short
        val DOCUMENT_TYPE_NODE: Short
        val DOCUMENT_FRAGMENT_NODE: Short
        val NOTATION_NODE: Short
        val DOCUMENT_POSITION_DISCONNECTED: Short
        val DOCUMENT_POSITION_PRECEDING: Short
        val DOCUMENT_POSITION_FOLLOWING: Short

Response:
val DOCUMENT_POSITION_CONTAINS: Short
        val DOCUMENT_POSITION_CONTAINED_BY: Short
        val DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: Short
    }
}

/**
 * Exposes the JavaScript [SVGRectElement](https://developer.mozilla.org/en/docs/Web/API/SVGRectElement) to Kotlin<|endoftext|>


Prompt:
// FILE: Constants.java

public class Constants {
    public static final String FIRST = "1st";
    public static final String SECOND = "2nd";
}

// FILE: const.kt
const val a = "something"
<!MUST_BE_INITIALIZED!><!CONST_VAL_WITHOUT_INITIALIZER!>const<!> val b<!>

Response:
<!TYPE_CANT_BE_USED_FOR_CONST_VAL!>const<!> val c = null
<!TYPE_CANT_BE_USED_FOR_CONST_VAL!>const<!> val d = ForConst
const val e = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>ForConst.one()<!><|endoftext|>


Prompt:
* Returns a list containing first elements satisfying the given [predicate].
 *
 * @sample samples.collections.Collections.Transformations.take
 */
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun UIntArray.takeWhile(predicate: (UInt) -> Boolean): List<UInt> {

Response:
val list = ArrayList<UInt>()
    for (item in this) {
        if (!predicate(item))
            break
        list.add(item)
    }
    return list
}

/**
 * Returns a list containing first elements satisfying the given [predicate].
 *
 * @sample samples.collections.Collections.Transformations.take
 */
@SinceKotlin("1.3")<|endoftext|>


Prompt:
val filesWithReposFirst = runBlocking {
            MavenDependenciesResolver().resolveFromAnnotations(annotationsWithReposFirst)
        }.valueOrThrow()

        val filesWithDependsOnFirst = runBlocking {
            MavenDependenciesResolver().resolveFromAnnotations(annotationsWithDependsOnFirst)
        }.valueOrThrow()

        // Tests that the jar was resolved

Response:
assert(
            filesWithReposFirst.any { it.name.startsWith("kotlin-shell-core-") && it.extension == "jar" }
        )
        assert(
            filesWithDependsOnFirst.any { it.name.startsWith("kotlin-shell-core-") && it.extension == "jar" }
        )<|endoftext|>


Prompt:
val typeParameters = getTypeConstructor().parameters
            val typeParameterCount = typeParameters.size

            val parametersAsTypeProjections = when {
                typeParameterCount == supertypeParameterCount ->
                    typeParameters.map { parameter ->
                        TypeProjectionImpl(Variance.INVARIANT, parameter.defaultType)
                    }

Response:
typeParameterCount == 1 && supertypeParameterCount > 1 && annotatedPurelyImplementedFqName == null -> {
                    val parameter = TypeProjectionImpl(Variance.INVARIANT, typeParameters.single().defaultType)
                    (1..supertypeParameterCount).map { parameter } // TODO: List(supertypeParameterCount) { parameter }
                }
                else -> return null
            }<|endoftext|>


Prompt:
"commonMain" to null,
                ),
                listOf(
                    listOf(
                        absolutePath("commonMain")
                    ),
                )
            ),
        )
    }

    private fun absolutePath(first: String, vararg next: String): Path {
        return Paths.get("").toAbsolutePath().root.resolve(Paths.get(first, *next))
    }

Response:
private fun directoriesToCopy(
        fileSystem: HashMap<String, Any?>,
        resourcesSplitByLevel: List<List<Path>>,
    ): AssembleHierarchicalResourcesTask.SourceSetWalk.Result<List<Path>> {
        val fakeFs = buildFakeFileSystem(contents = fileSystem)
        return AssembleHierarchicalResourcesTask.SourceSetWalk<File, Path>(<|endoftext|>


Prompt:
override suspend fun sharedSourceSetName(compilation: KotlinCompilation<*>): String? {
                val sourceSetTree = KotlinSourceSetTree.orNull(compilation)?.name ?: return null
                return lowerCamelCaseName(name, sourceSetTree)
            }
        }

        final override fun toString(): String = when (this) {
            is Group -> name

Response:
is Root -> "<root>"
        }
    }

    override fun toString(): String {
        if (children.isEmpty()) return node.toString()
        return node.toString() + "\n" + children.joinToString("\n").prependIndent("----")
    }
}<|endoftext|>