Prompt:
internal class ExposedReceiverTypeImpl(
    override val elementVisibility: EffectiveVisibility,
    override val restrictingDeclaration: KtSymbol,
    override val restrictingVisibility: EffectiveVisibility,
    firDiagnostic: KtPsiDiagnostic,
    token: KtLifetimeToken,

Response:
) : KtAbstractFirDiagnostic<KtTypeReference>(firDiagnostic, token), KtFirDiagnostic.ExposedReceiverType

internal class ExposedPropertyTypeImpl(
    override val elementVisibility: EffectiveVisibility,
    override val restrictingDeclaration: KtSymbol,
    override val restrictingVisibility: EffectiveVisibility,<|endoftext|>


Prompt:
package org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.signatureSubstitution

import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.persistentListOf
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession

Response:
import org.jetbrains.kotlin.analysis.api.components.buildClassType
import org.jetbrains.kotlin.analysis.api.components.buildSubstitutor
import org.jetbrains.kotlin.analysis.api.signatures.KtFunctionLikeSignature
import org.jetbrains.kotlin.analysis.api.signatures.KtVariableLikeSignature<|endoftext|>


Prompt:
// EXPECTED_REACHABLE_NODES: 1287
package foo

fun box(): String {
    var c = 2

    while (fizz(c) % 2 == 0 || buzz(c) % 3 == 0) {
        if (c > 4) throw Exception("Timeout!")
        c++
    }

Response:
assertEquals("fizz(2);fizz(3);buzz(3);fizz(4);fizz(5);buzz(5);", pullLog())

    return "OK"
}<|endoftext|>


Prompt:
internal fun KtElementImplStub<*>.getAllModifierLists(): Array<out KtDeclarationModifierList> =
        getStubOrPsiChildren(KtStubElementTypes.MODIFIER_LIST, KtStubElementTypes.MODIFIER_LIST.arrayFactory)

    // TODO: remove this method and its usages in 1.4

Response:
private fun checkNonParenthesizedAnnotationsOnFunctionalType(
        typeElement: KtFunctionType,
        annotationEntries: List<KtAnnotationEntry>,
        trace: BindingTrace
    ) {
        val lastAnnotationEntry = annotationEntries.lastOrNull()
        val isAnnotationsGroupedUsingBrackets =<|endoftext|>


Prompt:
val otherFiles = absoluteFiles("test/other/file.xml", "some/other/baddir")

        addDependency(
            JpsJavaDependencyScope.COMPILE,
            listOf(findModule("module")),
            false,
            "LibraryWithBadRoots",
            *(filesToBeReported + otherFiles),
        )

        val result = buildAllModules()

Response:
result.assertSuccessful()

        val actualWarnings = result.getMessages(BuildMessage.Kind.WARNING).map { it.messageText }
        val expectedWarnings = filesToBeReported.map { "Classpath entry points to a non-existent location: $it" }

        val expectedText = expectedWarnings.sorted().joinToString("\n")<|endoftext|>


Prompt:
x <!USELESS_ELVIS!>?: 1<!>
        x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
        ""
    }
    val ret3 = build3 {
        emit(1)

Response:
get()<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>("")
        val x = get()
        x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>("")<|endoftext|>


Prompt:
}

    object EnumEntry : DescriptorKindExclude() {
        override fun excludes(descriptor: DeclarationDescriptor)
                = descriptor is ClassDescriptor && descriptor.kind == ClassKind.ENUM_ENTRY

        override val fullyExcludedDescriptorKinds: Int get() = 0
    }

    object TopLevelPackages : DescriptorKindExclude() {

Response:
override fun excludes(descriptor: DeclarationDescriptor): Boolean {
            val fqName = when (descriptor) {
                is PackageFragmentDescriptor -> descriptor.fqName
                is PackageViewDescriptor -> descriptor.fqName
                else -> return false
            }
            return fqName.parent().isRoot
        }<|endoftext|>


Prompt:
override val incompatibilityType: ExpectActualAnnotationsIncompatibilityType<FirAnnotation>,
    firDiagnostic: KtPsiDiagnostic,
    token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.ActualAnnotationsNotMatchExpect

Response:
internal class OptionalDeclarationOutsideOfAnnotationEntryImpl(
    firDiagnostic: KtPsiDiagnostic,
    token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.OptionalDeclarationOutsideOfAnnotationEntry

internal class OptionalDeclarationUsageInNonCommonSourceImpl(<|endoftext|>


Prompt:
p_h = u + v
        p_h = doubleSetWord(d = p_h, lo = 0)
        p_l = v - (p_h - u)
        z_h = cp_h * p_h        /* cp_h+cp_l = 2/(3*log2) */

Response:
z_l = cp_l * p_h + p_l * cp + dp_l[k]
        /* log2(ax) = (ss+..)*2/(3*log2) = n + dp_h + z_h + z_l */
        t = n.toDouble()
        t1 = (((z_h + z_l) + dp_h[k]) + t)<|endoftext|>


Prompt:
model("incremental/invalidation/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.JS_IR, recursive = false)
            }

            testClass<AbstractJsFirES6InvalidationPerFileTest> {

Response:
model("incremental/invalidation/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.JS_IR_ES6, recursive = false)
            }

            testClass<AbstractJsFirES6InvalidationPerModuleTest> {<|endoftext|>


Prompt:
// NOTE: the unstable mask is indexed by valueParameter index, which is different
            // than the slotIndex but that is OKAY because we only care about defaults, which
            // also use the value parameter index.
            val realParams = declaration.valueParameters.take(
                declaration.contextReceiverParametersCount + scope.realValueParamCount
            )
            val unstableMask = realParams.map {

Response:
stabilityInferencer.stabilityOf((it.varargElementType ?: it.type)).knownUnstable()
            }.toBooleanArray()

            val hasAnyUnstableParams = unstableMask.any { it }

            // If we aren't in strong skipping mode and
            // if there are unstable params, then we fence the whole expression with a check to<|endoftext|>


Prompt:
if (this.w != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number & kotlin.Number?")!>w<!>.funNullableAny()
        if (this.w != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number & kotlin.Number?")!>w<!>

Response: if (w != null || <!SENSELESS_COMPARISON!>this.w != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number & kotlin.Number?"), DEBUG_INFO_SMARTCAST!>w<!>.equals(null)<|endoftext|>


Prompt:
* Computes the logarithm of the value [x] to the given [base].
 *
 * Special cases:
 *   - `log(x, b)` is `NaN` if either `x` or `b` are `NaN`
 *   - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0`

Response:
*   - `log(+Inf, +Inf)` is `NaN`
 *   - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1`
 *   - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1`
 *<|endoftext|>


Prompt:
* SPEC VERSION: 0.1-218
 * MAIN LINK: expressions, try-expression -> paragraph 1 -> sentence 3
 * PRIMARY LINKS: expressions, try-expression -> paragraph 1 -> sentence 2
 * NUMBER: 1
 * DESCRIPTION: try-expression has to start with a try body and continue with zero ore more catch blocks
 */
fun throwException(): Nothing = throw Exception()

// TESTCASE NUMBER: 1

Response:
fun case1() {
    try {
        val a = ""
    } catch (e: Exception) {
    }
}

// TESTCASE NUMBER: 2

fun case2() {
    try {
        val a = ""
        throwException()
    } catch (e: IllegalArgumentException) {
    } catch (e: ExcA) {
    } catch (e: ExcB) {<|endoftext|>


Prompt:
val simpleFunction = expression.symbol.owner
        val property = simpleFunction.correspondingPropertySymbol?.owner ?: return super.visitCall(expression)
        expression.transformChildrenVoid()

        if (shouldSubstituteAccessorWithField(property, simpleFunction) ||
            isDefaultAccessorForCompanionPropertyBackingFieldOnCurrentClass(property, simpleFunction)
        ) {

Response:
backendContext.createIrBuilder(currentScope!!.scope.scopeOwnerSymbol, expression.startOffset, expression.endOffset).apply {
                return when (simpleFunction) {
                    property.getter -> substituteGetter(property, expression)
                    property.setter -> substituteSetter(property, expression)
                    else -> error("Orphaned property getter/setter: ${simpleFunction.render()}")
                }<|endoftext|>


Prompt:
* @sample samples.collections.Collections.Transformations.flatMapIndexed
 */
@SinceKotlin("1.4")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("flatMapIndexedIterable")
@kotlin.internal.InlineOnly

Response:
public inline fun <R> CharArray.flatMapIndexed(transform: (index: Int, Char) -> Iterable<R>): List<R> {
    return flatMapIndexedTo(ArrayList<R>(), transform)
}

/**
 * Returns a single list of all elements yielded from results of [transform] function being invoked on each element
 * and its index in the original array.
 *<|endoftext|>


Prompt:
*   "else" branch, for example, because that code path will encounter no lambdas. Instead, any assignments done in elided
         *   blocks are immediately propagated to the parents, which is why the "entry" node contains `y`.
         *
         * - the "lambda" and "empty" nodes are not merge points, but they are what the CFG is for: if the lambda is not called-in-place,

Response:
*   then all variables it assigns to cannot be smartcasted in "empty" or its successors and vice versa, as the body of the lambda
         *   can be executed at arbitrary points on that path.
         *
         * - changes to `z` is captured and back-propagated to all earlier nodes as desired.
         *<|endoftext|>


Prompt:
abstract override val inputTypes: Collection<ConeKotlinType>
    abstract override val outputType: ConeKotlinType?
    override var analyzed: Boolean = false
    abstract override val expectedType: ConeKotlinType?
}

//  ------------- Lambdas -------------

class ResolvedLambdaAtom(
    override val atom: FirAnonymousFunction,

Response:
expectedType: ConeKotlinType?,
    val expectedFunctionTypeKind: FunctionTypeKind?,
    val receiver: ConeKotlinType?,
    val contextReceivers: List<ConeKotlinType>,
    val parameters: List<ConeKotlinType>,
    var returnType: ConeKotlinType,<|endoftext|>


Prompt:
moduleData = session.nullableModuleData ?: function.moduleData
                        this.name = name
                        symbol = it
                        status = function.status.copy(modality = Modality.FINAL)
                        delegateGetter = function
                        deprecationsProvider = UnresolvedDeprecationProvider
                    }
                }
            }

            processor(symbol)
        }
    }

Response:
override fun processDirectOverriddenFunctionsWithBaseScope(
        functionSymbol: FirNamedFunctionSymbol,
        processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction
    ): ProcessorAction {
        return ProcessorAction.NONE
    }

    override fun processDirectOverriddenPropertiesWithBaseScope(
        propertySymbol: FirPropertySymbol,<|endoftext|>


Prompt:
internal val friendPathsSet: Set<String>
        get() {
            val buildDirFile = projectLayout.buildDirectory.asFile.get()
            return friendPaths
                .filter { it.exists() }
                .map { it.normalize().relativeTo(buildDirFile).invariantSeparatorsPath }.toSet()
        }

    @get:Internal

Response:
val startParameters = BuildReportsService.getStartParameters(project)

    @get:Input
    @get:Optional
    abstract val explicitApiMode: Property<ExplicitApiMode>

    @get:Internal
    internal abstract val suppressKotlinOptionsFreeArgsModificationWarning: Property<Boolean><|endoftext|>


Prompt:
else -> exprs.reduce { a, b ->
                    irOr(a, b)
                }
            }
        }

        is Stability.Certain ->
            if (stable)
                irConst(StabilityBits.STABLE.bitsForSlot(0))
            else
                null

        is Stability.Parameter -> resolve(parameter)
        is Stability.Runtime -> {

Response:
val stableField = declaration.makeStabilityField()
            IrGetFieldImpl(
                UNDEFINED_OFFSET,
                UNDEFINED_OFFSET,
                stableField.symbol,
                stableField.type
            )
        }

        is Stability.Unknown -> null
    }

    // set the bit at a certain index<|endoftext|>


Prompt:
/**
     * Converts this [Int] value to [Byte].
     *
     * If this value is in [Byte.MIN_VALUE]..[Byte.MAX_VALUE], the resulting `Byte` value represents
     * the same numerical value as this `Int`.
     *
     * The resulting `Byte` value is represented by the least significant 8 bits of this `Int` value.
     */

Response:
@kotlin.internal.IntrinsicConstEvaluation
    public override fun toByte(): Byte

    /**
     * Converts this [Int] value to [Char].
     *
     * If this value is in the range of `Char` codes `Char.MIN_VALUE..Char.MAX_VALUE`,
     * the resulting `Char` code is equal to this value.
     *<|endoftext|>


Prompt:
) : KotlinBackendIrHolder {
    override val kotlinIr: IrElement
        get() = irModule
}

internal val CodegenPhase = createSimpleNamedCompilerPhase<NativeGenerationState, CodegenInput>(
        name = "Codegen",
        description = "Code generation",

Response:
preactions = getDefaultIrActions<CodegenInput, NativeGenerationState>() + getDefaultLlvmModuleActions(),
        postactions = getDefaultIrActions<CodegenInput, NativeGenerationState>() + getDefaultLlvmModuleActions(),
        op = { generationState, input ->
            val context = generationState.context
            generationState.objCExport = ObjCExport(
                    generationState,<|endoftext|>


Prompt: <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function<kotlin.Any>")!>select(id(A3()), id(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.reflect.KFunction2<A3, kotlin.Int, kotlin.Unit>")!>A3::foo1<!>), { a: Number ->

Response: <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number")!>a<!><|endoftext|>


Prompt:
}

@JsModule("./dataClass.mjs")
external fun jsBox(): JsResult

fun box(): String {
    val res = jsBox()
    if (res.copy00 != "[3::7]") {
        return "Fail1: ${res.copy00}"
    }
    if (res.copy01 != "[3::11]") {

Response:
return "Fail2: ${res.copy01}"
    }
    if (res.copy10 != "[15::7]") {
        return "Fail3: ${res.copy10}"
    }
    if (res.copy11 != "[13::11]") {
        return "Fail4: ${res.copy11}"
    }

    return "OK"
}<|endoftext|>


Prompt:
fun test5f(x: Float, y: Any) = y is Float && x == y
fun test6f(x: Any, y: Any) = x is Float && y is Float && x == y

// The following possibly should not compile (but so far it does)
// because of EQUALITY_NOT_APPLICABLE.

Response:
fun testFD(x: Any, y: Any) = x is Float && y is Double && x == y
fun testDF(x: Any, y: Any) = x is Double && y is Float && x == y<|endoftext|>


Prompt:
private val definitions = mutableMapOf<JsName, Int>()
    private val usages = mutableMapOf<JsName, Int>()
    private val definedValues = mutableMapOf<JsName, JsExpression>()
    private val temporary = mutableSetOf<JsName>()
    private val capturedInClosure = mutableSetOf<JsName>()
    private var hasChanges = false

Response:
private val localVariables = function.collectLocalVariables()

    // During `perform` phase we collect all variables we should substitute and all statements we should remove later,
    // when cleaning-up
    private val namesToSubstitute = mutableSetOf<JsName>()
    private val statementsToRemove = mutableSetOf<JsNode>()<|endoftext|>


Prompt:
* Returns a string representation of the contents of the specified array as if it is [List].
 *
 * @sample samples.collections.Arrays.ContentOperations.contentToString
 */
@SinceKotlin("1.4")
public actual fun LongArray?.contentToString(): String {
    return this?.joinToString(", ", "[", "]") ?: "null"
}

/**

Response:
* Returns a string representation of the contents of the specified array as if it is [List].
 *
 * @sample samples.collections.Arrays.ContentOperations.contentToString
 */
@SinceKotlin("1.4")
public actual fun FloatArray?.contentToString(): String {
    return this?.joinToString(", ", "[", "]") ?: "null"
}

/**<|endoftext|>


Prompt:
override fun onMatchedClasses(expectClassSymbol: IrClassSymbol, actualClassSymbol: IrClassSymbol) {
            shouldNotBeCalled()
        }

        override fun onMatchedCallables(expectSymbol: IrSymbol, actualSymbol: IrSymbol) {
            require(expectSymbol == baseExpectSymbol)
            matchingActuals += actualSymbol

Response:
}
    }
    AbstractExpectActualMatcher.matchSingleExpectTopLevelDeclarationAgainstPotentialActuals(
        expectSymbol,
        actualSymbols,
        context,
    )
    return matchingActuals
}

internal fun recordActualForExpectDeclaration(
    expectSymbol: IrSymbol,
    actualSymbol: IrSymbol,<|endoftext|>


Prompt:
// instances. A naive implementation would cache both S1 in `cachedPackageNames` and S2 in `topLevelClassifierPackageNames`.
        // `hasSpecificClassifierPackageNamesComputation` gives the provider enough information to avoid computing and caching S2 entirely,
        // so that S1 will also be cached in `topLevelClassifierPackageNames`.
        if (hasSpecificClassifierPackageNamesComputation) {

Response:
computePackageNamesWithTopLevelClassifiers()?.let { return@lazy it }
        }
        cachedPackageNames
    }

    private val topLevelClassifierNamesByPackage =
        session.firCachesFactory.createCache(::computeTopLevelClassifierNames)

    private val topLevelCallablePackageNames by lazy(LazyThreadSafetyMode.PUBLICATION) {<|endoftext|>


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

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


Prompt:
// test.kt:8 <init>
// test.kt:5 box
// test.kt:11 test
// test.kt:18 foo
// test.kt:19 foo
// test.kt:12 test
// test.kt:23 getProp
// test.kt:12 test
// test.kt:13 test
// test.kt:26 setProp
// test.kt:27 setProp

Response:
// test.kt:14 test
// test.kt:6 box

// EXPECTATIONS JS_IR
// test.kt:5 box
// test.kt:8 <init>
// test.kt:21 <init>
// test.kt:16 <init>
// test.kt:8 <init>
// test.kt:5 box
// test.kt:11 test
// test.kt:11 test<|endoftext|>


Prompt:
// FIR_IDENTICAL
// ALLOW_KOTLIN_PACKAGE
// !LANGUAGE: +UnrestrictedBuilderInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: annotation.kt

package kotlin

annotation class BuilderInference

// FILE: test.kt

class Builder<T> {
    fun add(t: T) {}
}

Response:
fun <S> build(g: Builder<S>.() -> Unit): List<S> = TODO()
fun <S> wrongBuild(g: Builder<S>.() -> Unit): List<S> = TODO()

fun <S> Builder<S>.extensionAdd(s: S) {}

fun <S> Builder<S>.safeExtensionAdd(s: S) {}

val member = build {<|endoftext|>


Prompt:
K2JsArgumentConstants::RUNTIME_DIAGNOSTIC_EXCEPTION.name to K2JsArgumentConstants.RUNTIME_DIAGNOSTIC_EXCEPTION,
                K2JsArgumentConstants::RUNTIME_DIAGNOSTIC_LOG.name to K2JsArgumentConstants.RUNTIME_DIAGNOSTIC_LOG,
            )

Response:
for ((key, value) in modes) {
                println("$key(\"$value\"),")
            }
            println(";")

            println()
            println("companion object {")
            withIndent {
                println("@JvmStatic")
                println("fun fromMode(mode: String): JsDiagnosticMode =")<|endoftext|>


Prompt:
inner class Bar {
        fun good() {
            contract {
                returns() implies (this@Bar != null)
            }
        }

        fun badOuter() {
            contract {
                <!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (this@Foo != null)<!>
            }
        }

        fun badInner() {
            contract {

Response:
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (this != null)<!>
            }
        }

        fun A?.goodWithReceiver() {
            contract {
                returns() implies (this@goodWithReceiver != null)
            }
        }

        fun A?.badWithReceiver() {
            contract {<|endoftext|>


Prompt:
val test11: List<Base> = <!INACCESSIBLE_TYPE!>listOf2(d1, d2)<!>
    // NB Inferred type is List<Impl> because List is covariant.

    val test12 = listOf2<Base>(d1, d2)

Response:
val test13 = <!INACCESSIBLE_TYPE!>arrayOf2(d1, d2)<!>

    val test14: Array<Base> = arrayOf2(d1, d2)
    // NB Inferred type is Array<Base> because Array is invariant.

    val test15 = arrayOf2<Base>(d1, d2)<|endoftext|>


Prompt:
override fun visitMemberAccess(expression: IrMemberAccessExpression<*>, data: D): IrElement {
        (0 until expression.typeArgumentsCount).forEach {
            expression.getTypeArgument(it)?.let { type ->
                expression.putTypeArgument(it, transformType(expression, type, data))
            }
        }
        return super.visitMemberAccess(expression, data)
    }

Response:
override fun visitClassReference(expression: IrClassReference, data: D): IrExpression {
        expression.classType = transformType(expression, expression.classType, data)
        return super.visitClassReference(expression, data)
    }

    override fun visitConstantObject(expression: IrConstantObject, data: D): IrConstantValue {<|endoftext|>


Prompt:
*  A. top-level/member properties of non-local class ("public" properties)
             *  B. local delegated properties/delegated properties of local classes ("private" properties)
             *
             * Here are some facts for this differences:
             * 1. Property of kind `B` may be written inside scope of some other delegate/PCLA inference (e.g., inside another delegate or

Response:
*    `buildList` lambda), and property of kind `A` are always analyzed in top-level delegate inference session
             * 2. Once written, the resolved return type ref of property of kind `A` can be observed by different threads.
             *    [ReturnTypeCalculatorWithJump] relies on the contract, that if some callable declaration has FirResolvedTypeRef as a return<|endoftext|>


Prompt:
override fun visitAnnotationCall(annotationCall: FirAnnotationCall, data: Nothing?) {
        visitWithCallOrAssignment(annotationCall)
    }

    override fun visitVariableAssignment(variableAssignment: FirVariableAssignment, data: Nothing?) {
        visitWithCallOrAssignment(variableAssignment)
    }

Response:
override fun visitDelegatedConstructorCall(delegatedConstructorCall: FirDelegatedConstructorCall, data: Nothing?) {
        visitWithCallOrAssignment(delegatedConstructorCall)
    }

    override fun visitGetClassCall(getClassCall: FirGetClassCall, data: Nothing?) {
        visitWithGetClassCall(getClassCall)
    }<|endoftext|>


Prompt:
ranges[index - 1] = newPrevious
                } else {
                    ranges.removeAt(index - 1)
                    index--
                }
            } else {
                index--
            }
        }

//        if (this is LetterRangesBuilder) {
//            println(ranges.joinToString(separator = "\n"))
//        }

Response:
//        if (this is CharCategoryRangesBuilder) {
//            println(ranges.subList(fromIndex = 0, toIndex = 10).joinToString(separator = "\n"))
//        }

        return Triple(ranges.map { it.rangeStart() }, ranges.map { it.rangeEnd() }, ranges.map { it.category() })
    }

    /**<|endoftext|>


Prompt:
if (funWithReturnsNull(value_1 is Float? && value_1 != null && value_2 != null) == null) {
        println(value_1.dec())
        println(value_2<!UNNECESSARY_SAFE_CALL!>?.<!>toByte())
    }
}

// TESTCASE NUMBER: 10
class case_10_class {

Response:
val prop_1: Int? = 10

    fun case_10(value_1: Any?, value_2: Number?) {
        val o = case_10_class()
        if (funWithReturnsTrue(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null && this.prop_1 != null)) {
            println(value_1.dec())<|endoftext|>


Prompt:
protected abstract val dataFlowInfoProviderImpl: KtDataFlowInfoProvider

    internal val klibSourceFileProvider: KtKlibSourceFileNameProvider get() = klibSourceFileProviderImpl
    protected abstract val klibSourceFileProviderImpl: KtKlibSourceFileNameProvider
}

public fun KtAnalysisSession.getModule(element: PsiElement): KtModule {

Response:
return ProjectStructureProvider.getModule(useSiteModule.project, element, useSiteModule)
}<|endoftext|>


Prompt:
val areThereConstraintsWithUninferredTypeParameter = constraints.any { c -> c.type.contains { it.isUninferredParameter() } }
        return constraints.any { isProperArgumentConstraint(it) } && !areThereConstraintsWithUninferredTypeParameter
    }

    private fun Context.isProperArgumentConstraint(c: Constraint) =

Response:
isProperType(c.type)
                && c.position.initialConstraint.position !is DeclaredUpperBoundConstraintPosition<*>
                && !c.isNullabilityConstraint

    private fun Context.isProperType(type: KotlinTypeMarker): Boolean =<|endoftext|>


Prompt:
const val ui0 = UInt(-1)
const val ui1 = UInt(0)
const val ui2 = UInt(40 + 2)

@AnnoUB(UByte(1), ub0)
fun f0() {}

@AnnoUS(UShort(<!INTEGER_OPERATOR_RESOLVE_WILL_CHANGE!>2 + 5<!>), us0)

Response:
fun f1() {}

@AnnoUI(ui0, ui1, ui2, UInt(100))
fun f2() {}

@AnnoUL(ul0, ULong(5))
fun f3() {}

const val explicit: UInt = UInt(2)<|endoftext|>


Prompt:
)

            build("compileKotlin") {
                assertTasksExecuted(":compileKotlin")

                assertCompilerArgument(":compileKotlin", "-Xexplicit-api=warning")
            }

            build(":compileTestKotlin") {
                assertTasksExecuted(":compileTestKotlin")

Response:
assertNoCompilerArgument(":compileTestKotlin", "-Xexplicit-api=warning")
            }
        }
    }

    @JvmGradlePluginTests
    @DisplayName("Explicit api strict mode produces errors on violation")
    @GradleTest
    fun explicitApiStrict(gradleVersion: GradleVersion) {
        project(
            "simpleProject",<|endoftext|>


Prompt:
descriptor: PropertyAccessorDescriptor,
        context: DeclarationCheckerContext
    ) {
        val propertyDescriptor = descriptor.correspondingProperty
        val propertyPsi = declaration.parent as? KtProperty ?: return
        val name = propertyPsi.nameIdentifier
        val initializer = propertyPsi.initializer
        val hasComposableAnnotation = descriptor.hasComposableAnnotation()

Response:
if (descriptor.overriddenDescriptors.isNotEmpty()) {
            val override = descriptor.overriddenDescriptors.first()
            val overrideComposable = override.hasComposableAnnotation()
            if (overrideComposable != hasComposableAnnotation) {
                context.trace.report(
                    ComposeErrors.CONFLICTING_OVERLOADS.on(
                        declaration,<|endoftext|>


Prompt: <!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J & DeepObject.A.B.C.D.E.F.G.J?"), DEBUG_INFO_SMARTCAST!>a<!>.funAny()

Response: <!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J & DeepObject.A.B.C.D.E.F.G.J?")!>a<!>.funNullableT()<|endoftext|>


Prompt:
// IGNORE_BACKEND: JS
// RUN_PLAIN_BOX_FUNCTION
// INFER_MAIN_MODULE

// MODULE: export_interface
// FILE: lib.kt

interface ParentI {
   val str: String
}

@JsExport
interface I : ParentI {
    val value: Int
    var variable: Int
    fun foo(): String
}

interface ExtendedI: I {

Response:
fun bar(): Int
}

open class NotExportedClass(override var value: Int) : ExtendedI {
    override var variable: Int = value
    override open fun foo(): String = "Not Exported"
    override val str: String = "test 1"
    override open fun bar(): Int = 42
}

@JsExport<|endoftext|>


Prompt:
val allCachedBitcodeDependencies: List<DependenciesTracker.ResolvedDependency>) {

    companion object {
        private const val NATIVE_DEPENDENCIES_TO_LINK = "NATIVE_DEPENDENCIES_TO_LINK"
        private const val ALL_NATIVE_DEPENDENCIES = "ALL_NATIVE_DEPENDENCIES"

Response:
private const val ALL_CACHED_BITCODE_DEPENDENCIES = "ALL_CACHED_BITCODE_DEPENDENCIES"

        fun serialize(res: DependenciesTrackingResult): List<String> {<|endoftext|>


Prompt:
WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET.on(annotationEntry, "undefined target", target.renderName)
                    else
                        WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET_ON_TYPE.on(annotationEntry, target.renderName)

                reportDiagnosticOnce(diagnostic)
            }
        }

Response:
}

    private fun BindingTrace.checkDeclaration(
        annotated: KtAnnotated,
        languageVersionSettings: LanguageVersionSettings,
        descriptor: DeclarationDescriptor
    ) {
        for (annotation in annotated.annotationEntries) {
            val useSiteTarget = annotation.useSiteTarget
            val target = useSiteTarget?.getAnnotationUseSiteTarget() ?: continue<|endoftext|>


Prompt:
packedFields.add(IndexedField(offset, field))
        }
        packedFields.sortBy { it.offset }
        return packedFields.map { it.field }
    }

    private fun createClassDeclarations(declaration: IrClass): ClassLlvmDeclarations {
        val internalName = qualifyInternalName(declaration)

        val fields =

Response:
if (context.config.packFields)
                packFields(declaration)
            else
                context.getLayoutBuilder(declaration).getFields(llvm)
        val (bodyType, alignment, fieldIndices) = createClassBody("kclassbody:$internalName", fields)

        require(alignment == runtime.objectAlignment) {<|endoftext|>


Prompt:
@JvmField val platformDependent: FqName = FqName("kotlin.internal.PlatformDependent")
        @JvmField val platformDependentClassId: ClassId = ClassId.topLevel(platformDependent)

        @JvmField val iterator: FqName = collectionsFqName("Iterator")
        @JvmField val iterable: FqName = collectionsFqName("Iterable")

Response:
@JvmField val collection: FqName = collectionsFqName("Collection")
        @JvmField val list: FqName = collectionsFqName("List")
        @JvmField val listIterator: FqName = collectionsFqName("ListIterator")
        @JvmField val set: FqName = collectionsFqName("Set")<|endoftext|>


Prompt:
if (classDescriptor.kind == ClassKind.ANNOTATION_CLASS && DescriptorUtils.isLocal(classDescriptor)) {
            trace.report(LOCAL_ANNOTATION_CLASS.on(languageVersionSettings, classOrObject))
        }
    }

    private fun checkTypesInClassHeader(classOrObject: KtClassOrObject) {

Response:
fun KtTypeReference.type(): KotlinType? = trace.bindingContext.get(TYPE, this)

        for (delegationSpecifier in classOrObject.superTypeListEntries) {
            val typeReference = delegationSpecifier.typeReference ?: continue
            typeReference.type()?.let { upperBoundChecker.checkBoundsInSupertype(typeReference, it, trace, languageVersionSettings) }<|endoftext|>


Prompt:
package org.jetbrains.kotlin.backend.jvm.lower

import org.jetbrains.kotlin.backend.common.FileLoweringPass
import org.jetbrains.kotlin.backend.common.ir.getAdditionalStatementsFromInlinedBlock
import org.jetbrains.kotlin.backend.common.ir.putStatementBeforeActualInline

Response:
import org.jetbrains.kotlin.backend.common.phaser.PhaseDescription
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.ir.createJvmIrBuilder
import org.jetbrains.kotlin.backend.jvm.ir.isInlineParameter<|endoftext|>


Prompt:
* Performs a logical `or` operation between this Boolean and the [other] one. Unlike the `||` operator,
     * this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
     */
    @kotlin.internal.IntrinsicConstEvaluation
    public infix fun or(other: Boolean): Boolean

Response:
/** Performs a logical `xor` operation between this Boolean and the [other] one. */
    @kotlin.internal.IntrinsicConstEvaluation
    public infix fun xor(other: Boolean): Boolean

    @kotlin.internal.IntrinsicConstEvaluation
    public override fun compareTo(other: Boolean): Int<|endoftext|>


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

import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
import org.jetbrains.kotlin.analysis.api.types.KtType
import org.jetbrains.kotlin.psi.KtDeclaration

Response:
import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.psi.KtFunction

public abstract class KtExpressionTypeProvider : KtAnalysisSessionComponent() {
    public abstract fun getKtExpressionType(expression: KtExpression): KtType?<|endoftext|>


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

import org.jetbrains.kotlin.config.CompilerConfigurationKey
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
import org.jetbrains.kotlin.konan.target.KonanTarget

class KonanConfigKeys {
    companion object {

Response:
// Keep the list lexically sorted.
        val BUNDLE_ID: CompilerConfigurationKey<String>
                = CompilerConfigurationKey.create("bundle ID to be set in Info.plist of a produced framework")
        val CHECK_DEPENDENCIES: CompilerConfigurationKey<Boolean>
                = CompilerConfigurationKey.create("check dependencies and download the missing ones")<|endoftext|>


Prompt:
set(_) = Unit
var propertyGetterMarkedWithAnotherFoo: String @Another.Foo get() = ""
    set(_) = Unit
var propertyGetterMarkedWithBar: String @Bar get() = ""
    set(_) = Unit
var propertyGetterMarkedWithAnotherBar: String @Another.Bar get() = ""
    set(_) = Unit

Response:
var propertySetterMarkedWithFoo: String get() = ""
    @Foo set(_) = Unit
var propertySetterMarkedWithAnotherFoo: String get() = ""
    @Another.Foo set(_) = Unit
var propertySetterMarkedWithBar: String get() = ""
    @Bar set(_) = Unit
var propertySetterMarkedWithAnotherBar: String get() = ""<|endoftext|>


Prompt:
// KT-65503 For all changed types, if oldType is a lambda or an anonymous object,
                        // and the newType is a name for an inline call,
                        // it should be added to the remapper to ensure correct inline conversion of nested anonymous objects or lambdas.
                        if (newType.contains(INLINE_CALL_TRANSFORMATION_SUFFIX) &&

Response:
!oldType.contains(INLINE_CALL_TRANSFORMATION_SUFFIX) &&
                            isAnonymousClass(oldType) &&
                            !remapper.hasNoAdditionalMapping(oldType)
                        ) {
                            remapper.addMapping(oldType, newType)
                        }
                    }
                    result.merge(transformResult)
                    result.addChangedType(oldClassName, newClassName)<|endoftext|>


Prompt:
// Potentially, this would have better to forbid calling manyParams, too.
    // But it might be complicated because we need to match that it is an override
    // Seems to be fine because `A::manyParams` is anyway an override in JVM and can be called with (a as K)
    a.manyParams {

Response: x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x30, x31, x32 -><|endoftext|>


Prompt:
require(n >= 0) { "Requested element count $n is less than zero." }
    return take((size - n).coerceAtLeast(0))
}

/**
 * Returns a list containing all elements except last [n] elements.
 *
 * @throws IllegalArgumentException if [n] is negative.
 *
 * @sample samples.collections.Collections.Transformations.drop
 */

Response:
public fun IntArray.dropLast(n: Int): List<Int> {
    require(n >= 0) { "Requested element count $n is less than zero." }
    return take((size - n).coerceAtLeast(0))
}

/**
 * Returns a list containing all elements except last [n] elements.
 *
 * @throws IllegalArgumentException if [n] is negative.
 *<|endoftext|>


Prompt:
"Case_Ignorable" -> caseIgnorableRanges.add(line)
        }
    }

    fun generate() {
        generateIsCasedTest()
        generateIsCaseIgnorableTest()
    }

    private fun generateIsCasedTest() {
        val file = outputDir.resolve("_IsCasedTest.kt")

Response:
generateRangesTest(casedRanges, file, "casedRanges", "isCased")
    }

    private fun generateIsCaseIgnorableTest() {
        val file = outputDir.resolve("_IsCaseIgnorableTest.kt")
        generateRangesTest(caseIgnorableRanges, file, "caseIgnorableRanges", "isCaseIgnorable")
    }<|endoftext|>


Prompt:
proto.addExtension(KlibMetadataProtoBuf.packageFragmentFiles, fileIdx)
            }

            override fun visitFqName(fqName: String) {
                proto.setExtension(KlibMetadataProtoBuf.fqName, fqName)
            }

            override fun visitClassName(className: ClassName) {

Response:
val classNameIdx = (c.strings as StringTableImpl).getQualifiedClassNameIndex(ClassId.fromString(className))
                proto.addExtension(KlibMetadataProtoBuf.className, classNameIdx)
            }
        })
    }

    override fun writeFunctionExtensions(
        kmFunction: KmFunction,<|endoftext|>


Prompt:
var lastIntrinsicCall: IrCall? = null
            while (saveToTmp is IrCall && (saveToTmp.symbol == boxIntrinsic || saveToTmp.symbol == unboxIntrinsic)) {
                if (lastIntrinsicCall == null) {

Response:
lastIntrinsicCall = JsIrBuilder.buildCall(saveToTmp.symbol, saveToTmp.type, saveToTmp.typeArguments.filterNotNull())
                    rootIntrinsicCall = lastIntrinsicCall
                } else {<|endoftext|>


Prompt:
contract { returns(true) implies (x is String) }
        return x is String
    }

    fun returnsFalse(x: Any?): Boolean {
        contract { returns(false) implies (x is String) }
        return x !is String
    }

    fun returnsNotNull(x: Any?): Any? {
        contract { returnsNotNull() implies (x is String) }

Response:
return when (x) {
            is String -> ""
            else -> null
        }
    }

    fun returnsNull(x: Any?): Any? {
        contract { returns(null) implies (x is String) }
        return when (x) {
            is String -> null
            else -> ""
        }
    }
}<|endoftext|>


Prompt:
assertPrints(1230.minutes.toString(DurationUnit.DAYS, 2), "0.85d")
        assertPrints(1230.minutes.toString(DurationUnit.HOURS, 2), "20.50h")
        assertPrints(1230.minutes.toString(DurationUnit.MINUTES), "1230m")

Response:
assertPrints(1230.minutes.toString(DurationUnit.SECONDS), "73800s")
    }

    @Sample
    fun parse() {
        val isoFormatString = "PT1H30M"
        val defaultFormatString = "1h 30m"
        val singleUnitFormatString = "1.5h"
        val invalidFormatString = "1 hour 30 minutes"<|endoftext|>


Prompt:
receiverArgumentType = TypeUtils.makeNullable(receiverArgumentType)
                }
            }
        }

        val dataFlowValue = dataFlowValueFactory.createDataFlowValue(receiverArgument, this)
        val nullability = dataFlowInfo.getStableNullability(dataFlowValue)
        val expression = (receiverArgument as? ExpressionReceiver)?.expression

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


Prompt:
+--- org.sample:liba (org.sample:liba-native): 2.0
            |    \--- org.jetbrains.kotlin:kotlin-stdlib: $KOTLIN_VERSION
            +--- org.sample:libb (org.sample:libb-native): 1.0
            |    ^^^ This module requires symbol sample.liba/C|null[0].

Response:
|    +--- org.sample:liba (org.sample:liba-native): 1.0 -> 2.0 (*)
            |    \--- org.jetbrains.kotlin:kotlin-stdlib: $KOTLIN_VERSION
            \--- org.jetbrains.kotlin:kotlin-stdlib: $KOTLIN_VERSION

            (*) - dependencies omitted (listed previously)<|endoftext|>


Prompt: if (y !== <!DEBUG_INFO_CONSTANT!>z<!> || <!DEBUG_INFO_CONSTANT!>y<!> != <!DEBUG_INFO_CONSTANT!>implicitNullableNothingProperty<!>) {

Response: val z1 = <!DEBUG_INFO_EXPRESSION_TYPE("case_25.`<anonymous>`.`<no name provided>`?")!><!DEBUG_INFO_EXPRESSION_TYPE("(() -> case_25.`<anonymous>`.`<no name provided>`?)? & () -> case_25.`<anonymous>`.`<no name provided>`?"),<|endoftext|>


Prompt:
class Universe(val width: Int, val height: Int) {
    var gen = Generation.random(width, height)

    fun evolve() {
        gen = gen.evolve()
    }
}

fun run(space: Int, time: Int) {
    val width = space
    val height = space
    val universe = Universe(width, height)
    for (i in 0 until time) {

Response:
universe.evolve()
    }
    Blackhole.consume(universe)
}

open class LifeBenchmark {
    val spaceScale = BENCHMARK_SIZE / 40
    val timeScale = 5

    fun bench() {
        run(spaceScale, timeScale)
    }
}

class LifeWithMarkHelpersBenchmark : LifeBenchmark() {<|endoftext|>


Prompt:
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalUnsignedTypes::class})
@kotlin.internal.InlineOnly
public inline fun kotlin.Short.toUShort(): kotlin.UShort

@kotlin.SinceKotlin(version = "2.0")

Response:
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalStdlibApi::class})
@kotlin.internal.InlineOnly
public inline fun <T : kotlin.AutoCloseable?, R> T.use(block: (T) -> R): R

public interface Annotation {
}

public open class Any {
    public constructor Any()<|endoftext|>


Prompt:
fun test5() {}

@JavaAnn(value = arrayOf("value"))
fun jTest1() {}

@JavaAnn(value = ["value"])
fun jTest2() {}

@JavaAnn(value = ["value"], path = ["path"])
fun jTest3() {}

annotation class IntAnn(vararg val i: Int)

@IntAnn(i = [1, 2])

Response:
fun foo1() {}

@IntAnn(i = intArrayOf(0))
fun foo2() {}<|endoftext|>


Prompt:
?: return ReplEvalResult.Error.CompileTime("Unable to access compiled script: ${compiledScriptList.get()}")

        val lastSnippetClass = history.peek()?.item?.first
        val historyBeforeSnippet = history.previousItems(compileResult.lineId).map { it.second }.toList()

Response:
val currentConfiguration = ScriptEvaluationConfiguration(baseScriptEvaluationConfiguration) {
            previousSnippets.put(historyBeforeSnippet)
            if (lastSnippetClass != null) {
                jvm {
                    baseClassLoader(lastSnippetClass.java.classLoader)
                }
            }
            if (scriptArgs != null) {
                constructorArgs(*scriptArgs.scriptArgs)<|endoftext|>


Prompt:
constructor(vararg providers: AdditionalAnnotationsProvider) : this(providers.toList())

    override fun addAllAnnotations(
        currentRawAnnotations: MutableList<in PsiAnnotation>,
        foundQualifiers: MutableSet<String>,
        owner: PsiElement,
    ) {
        providers.forEach { provider ->

Response:
provider.addAllAnnotations(currentRawAnnotations, foundQualifiers, owner)
        }
    }

    override fun findSpecialAnnotation(
        annotationsBox: GranularAnnotationsBox,
        qualifiedName: String,
        owner: PsiElement,<|endoftext|>


Prompt:
append(quotes)
    append(const.value.toString())
    append(quotes)
}

private fun renderClassWithRenderer(declaration: IrClass, renderer: RenderIrElementVisitor?, options: DumpIrTreeOptions) =
    declaration.runTrimEnd {
        "CLASS ${renderOriginIfNonTrivial()}" +
                "$kind name:$name " +

Response:
renderSignatureIfEnabled(options.printSignatures) +
                "modality:$modality visibility:$visibility " +
                renderClassFlags() +
                "superTypes:[${superTypes.joinToString(separator = "; ") { it.renderTypeWithRenderer(renderer, options) }}]"
    }<|endoftext|>


Prompt:
internal fun getMethodImplForSVGStringList(obj: SVGStringList, index: Int): String? { js("return obj[index];") }

public operator fun SVGStringList.get(index: Int): String? = getMethodImplForSVGStringList(this, index)

@Suppress("UNUSED_PARAMETER")

Response:
internal fun setMethodImplForSVGStringList(obj: SVGStringList, index: Int, newItem: String) { js("obj[index] = newItem;") }

public operator fun SVGStringList.set(index: Int, newItem: String) = setMethodImplForSVGStringList(this, index, newItem)

/**<|endoftext|>


Prompt:
override fun getTypeConstructor() = _typeConstructor

    override fun getOriginal() = this

    override fun getSource() = SourceElement.NO_SOURCE

    override fun getIndex() = owner.index

    override fun isCapturedFromOuterDeclaration() = false

    private val _defaultType: SimpleType by lazy {

Response:
KotlinTypeFactory.simpleTypeWithNonTrivialMemberScope(
            TypeAttributes.Empty, typeConstructor, emptyList(), false,
            LazyScopeAdapter {
                TypeIntersectionScope.create(
                    "Scope for type parameter " + name.asString(),
                    upperBounds
                )
            }
        )
    }

    override fun getDefaultType() = _defaultType<|endoftext|>


Prompt:
objectSymbol = namedClassOrObjectSymbol,
                containingClass = this,
                name = JvmAbi.INSTANCE_FIELD,
                lightMemberOrigin = null,
                isCompanion = false,
            )
        )
    }

    context(KtAnalysisSession)

Response:
private fun addFieldsForEnumEntries(result: MutableList<KtLightField>, classOrObjectSymbol: KtNamedClassOrObjectSymbol) {
        if (!isEnum) return

        classOrObjectSymbol.getStaticDeclaredMemberScope().getCallableSymbols()
            .filterIsInstance<KtEnumEntrySymbol>()
            .mapNotNullTo(result) {<|endoftext|>


Prompt:
//inline var newInlineProperty2: String
    //    get() = "OpenClass.newInlineProperty2"
    //    set(value) { lastRecordedState = "OpenClass.newInlineProperty2=$value" }

    //var newNonInlineProperty: String
    //    get() = "OpenClass.newNonInlineProperty"

Response:
//    set(value) { lastRecordedState = "OpenClass.newNonInlineProperty=$value" }

    fun newInlineProperty1Reader(): String = TODO("Not implemented: OpenClass.newInlineProperty1Reader()")
    fun newInlineProperty2Reader(): String = TODO("Not implemented: OpenClass.newInlineProperty2Reader()")<|endoftext|>


Prompt:
) = diagnostics.firstOrNull { diagnostic ->
        if (diagnostic.severity != Severity.ERROR) return@firstOrNull false
        if (diagnostic.factory in syntaxErrors) return@firstOrNull true
        val isResolutionError = diagnostic.factory in resolutionFailureErrors
        val isCallArgError = diagnostic.factory in callArgErrors
        val reportedPsi = diagnostic.psiElement

Response:
val reportedPsiParent = reportedPsi.parent
        when {
            // Errors reported on the querying element or the `selectorExpression`/`calleeExpression` of the querying element
            isResolutionError &&
                    (reportedPsi == psi ||
                            psi is KtQualifiedExpression && reportedPsi == psi.selectorExpression ||<|endoftext|>


Prompt:
public inline fun kotlin.ULongArray.reduceRightOrNull(operation: (kotlin.ULong, acc: kotlin.ULong) -> kotlin.ULong): kotlin.ULong?

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

Response:
public inline fun kotlin.UShortArray.reduceRightOrNull(operation: (kotlin.UShort, acc: kotlin.UShort) -> kotlin.UShort): kotlin.UShort?

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


Prompt:
import org.jetbrains.kotlin.kapt3.test.runners.AbstractIrKotlinKaptContextTest
import org.jetbrains.kotlin.kapt4.AbstractKotlinKapt4ContextTest
import org.jetbrains.kotlin.lombok.*
import org.jetbrains.kotlin.noarg.*

Response:
import org.jetbrains.kotlin.parcelize.test.runners.*
import org.jetbrains.kotlin.powerassert.AbstractFirLightTreeBlackBoxCodegenTestForPowerAssert
import org.jetbrains.kotlin.powerassert.AbstractIrBlackBoxCodegenTestForPowerAssert
import org.jetbrains.kotlin.samWithReceiver.*<|endoftext|>


Prompt:
@Test
    fun testContextReceiverAndDefaultParamsUsage(): Unit = contextReceivers(
        """
            class Foo {
                val someString = "Some String"
            }
        """,
        """
            @Composable
            fun Parent() {
                with(Foo()) {
                    Test()
                    Test(a = "a")
                    Test(b = 101)

Response:
Test(a = "Yes", b = 10)
                }
            }

            context(Foo)
            @Composable
            fun Test(a: String = "A", b: Int = 2) {
                val combineParams = a + b
                if (someString == combineParams) {
                    println("Same same")
                }
            }
        """
    )
}<|endoftext|>


Prompt:
package org.jetbrains.kotlin.codegen.range

import org.jetbrains.kotlin.codegen.ExpressionCodegen
import org.jetbrains.kotlin.codegen.generateCallReceiver
import org.jetbrains.kotlin.codegen.generateCallSingleArgument

Response:
import org.jetbrains.kotlin.codegen.range.comparison.getComparisonGeneratorForKotlinType
import org.jetbrains.kotlin.codegen.range.forLoop.ForInSimpleProgressionLoopGenerator
import org.jetbrains.kotlin.codegen.range.forLoop.ForLoopGenerator<|endoftext|>


Prompt:
val p8: <!NULLABLE_TYPE_OF_ANNOTATION_MEMBER!>Boolean?<!>)

annotation class InAnn4(val p1: <!INVALID_TYPE_OF_ANNOTATION_MEMBER!>Array<Int><!>,
                        val p2: <!NULLABLE_TYPE_OF_ANNOTATION_MEMBER!>Array<Int>?<!>)

Response:
annotation class InAnn6(val p:  <!NULLABLE_TYPE_OF_ANNOTATION_MEMBER!>Class<*>?<!>)
annotation class InAnn7(val p:  <!NULLABLE_TYPE_OF_ANNOTATION_MEMBER!>RetentionPolicy?<!>)<|endoftext|>


Prompt:
fun box() = parcelTest { parcel ->
    val test = Test(SealedClass1.SealedClass1Impl1)
    test.writeToParcel(parcel, 0)

    val bytes = parcel.marshall()
    parcel.unmarshall(bytes, 0, bytes.size)
    parcel.setDataPosition(0)

Response:
val test2 = parcelableCreator<Test>().createFromParcel(parcel)
    assert(test == test2)
}<|endoftext|>


Prompt:
override fun foo(): X<String>? = X(null)
}

fun box(): String {
    val t1: IFoo = Test()
    val x1 = t1.foo()
    if (x1 != X(null)) throw AssertionError("x1: $x1")

    val t2 = Test()
    val x2 = t2.foo()

Response:
if (x2 != X(null)) throw AssertionError("x2: $x2")

    return "OK"
}<|endoftext|>


Prompt:
@GradleWithJdkTest
    fun testIncrementalBinaryAggregatingChanges(gradleVersion: GradleVersion, jdk: JdkVersions.ProvidedJdk) {
        doIncrementalAggregatingChanges(
            gradleVersion,
            jdk,
            true
        )
    }

    private fun TestProject.checkAggregatingResource(check: (List<String>) -> Unit) {

Response:
val aggregatingResource = "build/tmp/kapt3/classes/main/generated.txt"
        assertFileInProjectExists(aggregatingResource)
        val lines = projectPath.resolve(aggregatingResource).readLines()
        check(lines)
    }

    private fun doIncrementalAggregatingChanges(
        gradleVersion: GradleVersion,<|endoftext|>


Prompt:
private val BODILESS_BUILTIN_CLASSES = listOf(
    "kotlin.String",
    "kotlin.Nothing",
    "kotlin.Array",
    "kotlin.Any",
    "kotlin.ByteArray",
    "kotlin.CharArray",
    "kotlin.ShortArray",
    "kotlin.IntArray",

Response:
"kotlin.LongArray",
    "kotlin.FloatArray",
    "kotlin.DoubleArray",
    "kotlin.BooleanArray",
    "kotlin.Boolean",
    "kotlin.Byte",
    "kotlin.Short",
    "kotlin.Int",
    "kotlin.Float",
    "kotlin.Double",<|endoftext|>


Prompt:
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.RecursiveTypealiasExpansion

internal class TypealiasShouldExpandToClassImpl(
    override val expandedType: KtType,
    firDiagnostic: KtPsiDiagnostic,

Response:
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.TypealiasShouldExpandToClass

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


Prompt:
open val f = "A"
}

class B(s: String) : A(s) {
    override val f = "B"
}

fun test(b1: Boolean, b2: Boolean): String {
    global = ""
    try {
        bar(
            foo("G") + foo(
                (if (b1) {
                    bar("then1")
                    (try {

Response:
if (b2) {
                            bar("then2")
                            A("X")
                        } else {
                            bar("else2")
                            B("Y")
                        }
                    } finally {

                    }).me()
                } else {
                    try {
                        bar("try3")
                        bar("else1")
                    } finally {

                    }
                    (if (b2) {<|endoftext|>


Prompt:
assertFailsWith<IndexOutOfBoundsException> { base64.encodeIntoByteArray(bytes, destination, destinationOffset = 1) }

            assertTrue(destination.all { it == 0.toByte() })

            var length = base64.encodeIntoByteArray(bytes, destination, endIndex = 3)

Response:
assertContentEquals(symbols.encodeToByteArray(0, 4), destination.copyOf(length))
            length += base64.encodeIntoByteArray(bytes, destination, destinationOffset = length, startIndex = 3)
            assertContentEquals(symbols.encodeToByteArray(), destination)
        }

        // decode(CharSequence)<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & Interface2 & Interface1 & ClassLevel2 & Interface3")!>t<!>.test2()
                        <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & Interface2 & Interface1 & ClassLevel2 & Interface3")!>t<!>
                    }
                }
            }
        }
    }
}

Response:
/*
 * TESTCASE NUMBER: 75
 * NOTE: lazy smartcasts
 * DISCUSSION
 * ISSUES: KT-28362
 */
fun case_75(t: Any?, z: Nothing?) {
    if (t !is ClassLevel2? || <!USELESS_IS_CHECK!>t !is ClassLevel1?<!>) else {<|endoftext|>


Prompt:
assertEquals(false, notNullToNotNullB(AIA()), "AIA is IB")
    assertEquals(true, notNullToNotNullB(AIB()), "AIB is IB")
    assertEquals(false, notNullToNotNullB(AIE()), "AIE is IB")
    assertEquals(true, notNullToNotNullB(AIF()), "AIF is IB")

Response:
assertEquals(true, notNullToNotNullB(AIJ()), "AIJ is IB")
    assertEquals(true, notNullToNotNullB(BAIA()), "BAIA is IB")
    assertEquals(true, notNullToNotNullB(BAIAIF()), "BAIAIF is IB")<|endoftext|>


Prompt: val test_dnd = <!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>d === nd<!> || <!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>nd === d<!> || <!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>d !== nd<!> ||

Response: <!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>nd !== d<!><|endoftext|>


Prompt:
override fun loadAnnotation(proto: ProtoBuf.Annotation, nameResolver: NameResolver): AnnotationDescriptor =
        annotationDeserializer.deserializeAnnotation(proto, nameResolver)

    override fun loadConstant(desc: String, initializer: Any): ConstantValue<*>? {
        val normalizedValue: Any = if (desc in "ZBCS") {

Response:
val intValue = initializer as Int
            when (desc) {
                "Z" -> intValue != 0
                "B" -> intValue.toByte()
                "C" -> intValue.toChar()
                "S" -> intValue.toShort()
                else -> throw AssertionError(desc)
            }
        } else {
            initializer
        }<|endoftext|>


Prompt:
// !API_VERSION: 1.0

@SinceKotlin("1.1")
open class Foo

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

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

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

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

// TODO: do not report API_NOT_AVAILABLE twice
fun t2() = object : <!API_NOT_AVAILABLE!>Foo<!>() {}<|endoftext|>


Prompt:
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import org.jetbrains.org.objectweb.asm.tree.MethodNode

class IrSourceCompilerForInline(
    override val state: GenerationState,
    override val callElement: IrFunctionAccessExpression,
    private val callee: IrFunction,
    internal val codegen: ExpressionCodegen,

Response:
private val data: BlockInfo
) : SourceCompilerForInline {
    override val callElementText: String
        get() = ir2string(callElement)

    override val inlineCallSiteInfo: InlineCallSiteInfo
        get() {
            val rootFunction = codegen.enclosingFunctionForLocalObjects
            return InlineCallSiteInfo(<|endoftext|>


Prompt:
override fun testNonAbiChangeInLib_changeMethodBody_tracked(gradleVersion: GradleVersion) {
        super.testNonAbiChangeInLib_changeMethodBody_tracked(gradleVersion)
    }

    @Disabled("KT-57147")
    @GradleTest
    override fun testAbiChangeInLib_changeMethodSignature(gradleVersion: GradleVersion) {

Response:
super.testAbiChangeInLib_changeMethodSignature(gradleVersion)
    }

    @Disabled("KT-57147")
    @GradleTest
    override fun testNonAbiChangeInLib_changeMethodBody(gradleVersion: GradleVersion) {
        super.testNonAbiChangeInLib_changeMethodBody(gradleVersion)
    }
}<|endoftext|>


Prompt:
calleeReference.accept(visitor, data)
    }

    override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirErrorAnnotationCallImpl {
        transformAnnotationTypeRef(transformer, data)
        transformTypeArguments(transformer, data)
        argumentList = argumentList.transform(transformer, data)

Response:
transformCalleeReference(transformer, data)
        return this
    }

    override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirErrorAnnotationCallImpl {
        return this
    }

    override fun <D> transformAnnotationTypeRef(transformer: FirTransformer<D>, data: D): FirErrorAnnotationCallImpl {<|endoftext|>


Prompt:
val diagnosticsService = testServices.diagnosticsService

    fun processModule(module: TestModule) {
        if (!processedModules.add(module)) return
        for (testFile in module.files) {
            val ktDiagnostics = ktDiagnosticReporter.diagnosticsByFilePath["/${testFile.name}"] ?: continue
            ktDiagnostics.forEach {

Response:
if (diagnosticsService.shouldRenderDiagnostic(module, it.factoryName, it.severity)) {
                    val metaInfos = it.toMetaInfos(module, testFile, globalMetadataInfoHandler, lightTreeEnabled, lightTreeComparingModeEnabled)
                    globalMetadataInfoHandler.addMetadataInfosForFile(testFile, metaInfos)
                }
            }
        }<|endoftext|>


Prompt:
fun transformToNullable(a: AsInt): AsInt? = a as AsInt
    fun transformToNullableTarget(a: AsInt): AsInt? = a as AsInt?
    fun transformNullableToNullableTarget(a: AsInt?): AsInt? = a as AsInt?
}

fun box(): String {
    val a = AsAny<Int>(42)

Response:
val b1 = Reference.transform<Int, Number>(a)
    val b2 = Reference.transformNullable<Int, Number>(a)
    val b3 = Reference.transformToNullable<Int, Number>(a)
    val b4 = Reference.transformToNullableTarget<Int, Number>(a)
    val b5 = Reference.transformNullableToNullableTarget<Int, Number>(a)<|endoftext|>


Prompt:
is WasmStructDeclaration ->
                                    gcTypes += type
                                is WasmArrayDeclaration -> {}
                            }
                        }
                    }

                    // Import section
                    2 -> {
                        forEachVectorElement {
                            val importPair = WasmImportDescriptor(readString(), readString())
                            when (val kind = b.readByte().toInt()) {
                                0 -> {

Response:
val type = functionTypes[b.readVarUInt32AsInt()]
                                    importedFunctions += WasmFunction.Imported(
                                        name = "",
                                        type = WasmSymbol(type),
                                        importPair = importPair,
                                    ).also { importsInOrder.add(it) }
                                }
                                // Table
                                1 -> {<|endoftext|>


Prompt:
val statements = result.declarations.statements
        val fileStatements = fileExports.file.accept(IrFileToJsTransformer(useBareParameterNames = true), staticContext).statements
        val exportFragment = fileExports.generateProgramFragmentForExport(mode, globalNameScope)

        if (fileStatements.isNotEmpty()) {
            var startComment = ""

Response:
if (generateRegionComments) {
                startComment = "region "
            }

            if (generateRegionComments || generateFilePaths) {
                val originalPath = fileExports.file.path
                val path = pathPrefixMap.entries
                    .find { (k, _) -> originalPath.startsWith(k) }<|endoftext|>


Prompt:
override fun getFunctionNames(): Set<Name> =
        getContributedDescriptors(
            DescriptorKindFilter.FUNCTIONS, alwaysTrue()
        ).filterIsInstanceMapTo<SimpleFunctionDescriptor, Name, MutableSet<Name>>(mutableSetOf()) { it.name }

    override fun getVariableNames(): Set<Name> =
        getContributedDescriptors(

Response:
DescriptorKindFilter.VARIABLES, alwaysTrue()
        ).filterIsInstanceMapTo<SimpleFunctionDescriptor, Name, MutableSet<Name>>(mutableSetOf()) { it.name }

    override fun getClassifierNames(): Set<Name>? = null

    // This method should not be implemented here by default: every scope class has its unique structure pattern<|endoftext|>


Prompt:
val result_2 = select(A(B()), A(x), A(if (true) B() else null))
    val result_3 = select(A(x), A(if (true) B() else null))

    <!DEBUG_INFO_EXPRESSION_TYPE("A<(B..B?)>")!>result_1<!>

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("A<(B..B?)>")!>result_2<!>
    <!DEBUG_INFO_EXPRESSION_TYPE("A<(B..B?)>")!>result_3<!>
}

fun case_2() {
    val x = Test.bar<Any>() // Any!
    val y: Any? = null<|endoftext|>


Prompt:
components: InferenceComponents,
        transformerComponents: BodyResolveComponents
    ): ConeCompositeConflictResolver {
        val specificityComparator = TypeSpecificityComparator.NONE
        // NB: Adding new resolvers is strongly discouraged because the results are order-dependent.
        return ConeCompositeConflictResolver(

Response:
ConeEquivalentCallConflictResolver(specificityComparator, components, transformerComponents),
            ConeIntegerOperatorConflictResolver,
            ConeOverloadConflictResolver(specificityComparator, components, transformerComponents),
        )
    }
}<|endoftext|>


Prompt:
public external fun ByteArray.setCharAt(index: Int, value: Char)

/**
 * Sets [Short] out of the [ByteArray] byte buffer at specified index [index]
 * @throws IndexOutOfBoundsException if [index] is outside of array boundaries.
 */
@ExperimentalNativeApi
@GCUnsafeCall("Kotlin_ByteArray_setShortAt")

Response:
public external fun ByteArray.setShortAt(index: Int, value: Short)

/**
 * Sets [UShort] out of the [ByteArray] byte buffer at specified index [index]
 * @throws IndexOutOfBoundsException if [index] is outside of array boundaries.
 */
@ExperimentalNativeApi
@GCUnsafeCall("Kotlin_ByteArray_setShortAt")
@ExperimentalUnsignedTypes<|endoftext|>


Prompt:
import kotlin.test.assertEquals
import kotlin.test.assertTrue

class HierarchicalModuleCommonizationTest : AbstractInlineSourcesCommonizationTest() {

    fun `test common modules hierarchically`() {
        val result = commonize {
            outputTarget("(a, b)", "(a, b, c)")

            target("a") {
                module {
                    name = "foo"

Response:
source("val foo: Int = 1")
                }

                module {
                    name = "bar"
                    source("val bar: Int = 1")
                }
            }

            target("b") {
                module {
                    name = "foo"
                    source("val foo: Int = 1")
                }

                module {
                    name = "bar"
                    source("val bar: Int = 1")<|endoftext|>


Prompt:
const val SURROGATE_CARDINALITY = 2048

        /**
         * Character classes.
         * See http://www.unicode.org/reports/tr18/, http://www.unicode.org/Public/4.1.0/ucd/Blocks.txt
         */
        enum class CharClasses(val regexName : String, val factory: () -> CachedCharClass) {

Response:
LOWER("Lower", ::CachedLower),
            UPPER("Upper", ::CachedUpper),
            ASCII("ASCII", ::CachedASCII),
            ALPHA("Alpha", ::CachedAlpha),
            DIGIT("Digit", ::CachedDigit),
            ALNUM("Alnum", :: CachedAlnum),
            PUNCT("Punct", ::CachedPunct),<|endoftext|>


Prompt:
internal actual fun ulongDivide(v1: ULong, v2: ULong): ULong {
    val dividend = v1.toLong()
    val divisor = v2.toLong()
    if (divisor < 0) { // i.e., divisor >= 2^63:
        return if (v1 < v2) ULong(0) else ULong(1)
    }

Response:
// Optimization - use signed division if both dividend and divisor < 2^63
    if (dividend >= 0) {
        return ULong(dividend / divisor)
    }

    // Otherwise, approximate the quotient, check, and correct if necessary.
    val quotient = ((dividend ushr 1) / divisor) shl 1<|endoftext|>


Prompt:
is ObjCClass -> StubOrigin.ObjCClass(container, isMeta = true)
                }
                return listOf(buildClassStub(origin))
            }
        }
)

internal class ObjCProtocolStubBuilder(
        context: StubsBuildingContext,
        private val protocol: ObjCProtocol
) : ObjCClassOrProtocolStubBuilder(context, protocol), StubElementBuilder {

Response:
override fun build(): List<StubIrElement> {
        val classStub = buildClassStub(StubOrigin.ObjCProtocol(protocol, isMeta = false))
        return listOf(*metaContainerStub!!.build().toTypedArray(), classStub)
    }
}

internal class ObjCClassStubBuilder(
        context: StubsBuildingContext,<|endoftext|>


Prompt:
UBInfo(0x0D80, 0x0DFF, "Sinhala"), // Character.UnicodeBlock.SINHALA
            /* 0E00; 0E7F; Thai */
            UBInfo(0x0E00, 0x0E7F, "Thai"), // Character.UnicodeBlock.THAI
            /* 0E80; 0EFF; Lao */

Response:
UBInfo(0x0E80, 0x0EFF, "Lao"), // Character.UnicodeBlock.LAO
            /* 0F00; 0FFF; Tibetan */
            UBInfo(0x0F00, 0x0FFF, "Tibetan"), // Character.UnicodeBlock.TIBETAN
            /* 1000; 109F; Myanmar */<|endoftext|>


Prompt:
package org.jetbrains.kotlin.backend.wasm.lower

import org.jetbrains.kotlin.backend.wasm.ir2wasm.WasmSignature
import org.jetbrains.kotlin.backend.wasm.ir2wasm.wasmSignature
import org.jetbrains.kotlin.ir.backend.js.JsCommonBackendContext

Response:
import org.jetbrains.kotlin.ir.backend.js.lower.BridgesConstruction
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction<|endoftext|>


Prompt:
package org.jetbrains.kotlin.tooling.core

import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertSame

class ClosureTest {

    private class Node(val value: String, var parent: Node? = null, val children: MutableList<Node> = mutableListOf()) {

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

    /* 'Children' is explicitly not implementing Collection */
    private class IterableNode(val value: String, val children: Children = Children(mutableListOf())) {

        /* Does not implement Collection */
        class Children(private val list: MutableList<IterableNode>) : Iterable<IterableNode> {<|endoftext|>


Prompt:
block: TestInterface<R>.() -> Unit
): R = TODO()

class Inv<K>

interface TestInterface<R> {
    fun emit(r: R)
    fun get(): R
    fun getInv(): Inv<R>
}

fun <U> id(x: U) = x

fun test() {
    val ret = build {
        emit("1")

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>get()<!>
        <!DEBUG_INFO_EXPRESSION_TYPE("Inv<kotlin.String>")!>getInv()<!>
        ""
    }
}<|endoftext|>


Prompt:
* Sealed class representing a type of path through a [Control Flow Graph (CFG) Node][org.jetbrains.kotlin.fir.resolve.dfa.cfg.CFGNode] used
 * for data flow analysis. Most CFG nodes only have a single data flow path through them, but there are times when a node may require

Response:
* multiple paths to be calculated. The most common use case is for `finally` code blocks, where multiple code paths may enter, but these
 * paths diverge after exiting the code block. Consider the following (very) contrived example:
 *
 * ```kotlin
 * fun test() {
 *     var x: Any? = null
 *     while (true) {
 *         try {
 *             x = "" // (1)<|endoftext|>


Prompt:
A.Companion::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>ext2<!>
    A::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>ext2<!>

    A::<!UNRESOLVED_REFERENCE!>foo<!>

Response:
A::<!UNRESOLVED_REFERENCE!>bar<!>
}<|endoftext|>


Prompt:
configureKotlinPomAttributes(project)
                    if (sbom && project.name !in internalPlugins) {
                        if (name == "pluginMaven") {
                            val sbomTask = configureSbom(target = "PluginMaven")
                            artifact(sbomTask) {
                                extension = "spdx.json"
                                builtBy(sbomTask)
                            }

Response:
} else if (name == "Main") {
                            val sbomTask = configureSbom()
                            artifact(sbomTask) {
                                extension = "spdx.json"
                                builtBy(sbomTask)
                            }
                        }
                    }
                }
        }
    }
    configureDefaultPublishing(signingRequired)
}

/**<|endoftext|>


Prompt:
return possiblePairBound == b.constructor.declarationDescriptor?.fqNameSafe
    }

    // We consider base bounds as readonly collection interfaces (e.g. kotlin.collections.Iterable).
    fun getBaseBoundFqNameByMutability(type: KotlinType): FqName? =

Response:
type.constructor.declarationDescriptor?.fqNameSafe?.let(::getBaseBoundFqNameByMutability)

    fun getBaseBoundFqNameByMutability(fqName: FqName): FqName? {
        return CommonFlexibleTypeBoundsChecker.getBaseBoundFqNameByMutability(fqName)
    }
}<|endoftext|>


Prompt:
if (convert2.id() != '')         return "Fail 8.2"
    if (convert3.id() != 1.toShort())   return "Fail 8.3"
    if (convert4.id() != 1)             return "Fail 8.4"
    if (convert5.id() != 1L)            return "Fail 8.5"

Response:
if (convert6.id() != 1.0f)          return "Fail 8.6"
    if (convert7.id() != 1.0)           return "Fail 8.7"

    if (equals1.id() != false)   return "Fail 9.1"
    if (equals2.id() != true)    return "Fail 9.2"<|endoftext|>


Prompt:
// 1 INVOKESTATIC KInterface2.access\$setBar\$jd
// 1 INVOKESTATIC KInterface.access\$getBar\$jd
// 1 INVOKESTATIC KInterface.access\$setBar\$jd

// 1 INVOKESPECIAL KInterface2.getBar
// 1 INVOKESPECIAL KInterface2.setBar

Response:
// 1 INVOKESPECIAL KInterface.getBar
// 1 INVOKESPECIAL KInterface.setBar<|endoftext|>


Prompt:
import org.jetbrains.kotlin.descriptors.impl.PackageFragmentDescriptorImpl
import org.jetbrains.kotlin.incremental.ANDROID_LAYOUT_CONTENT_LOOKUP_NAME
import org.jetbrains.kotlin.incremental.components.LookupLocation
import org.jetbrains.kotlin.incremental.components.LookupTracker

Response:
import org.jetbrains.kotlin.incremental.recordPackageLookup
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.descriptorUtil.module
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter<|endoftext|>


Prompt:
if (sameAbiDir.exists()) {
            val sameAbi = Compilation(testDir, "sameAbi").also { make(it) }
            assertEqualDirectories(sameAbi.abiDir, base.abiDir, forgiveExtraFiles = false)
        }

        if (differentAbiDir.exists()) {

Response:
val differentAbi = Compilation(testDir, "differentAbi").also { make(it) }
            assertFails("$base and $differentAbi abi are equal") {
                assertEqualDirectories(differentAbi.abiDir, base.abiDir, forgiveExtraFiles = false)
            }
        }
    }
}<|endoftext|>


Prompt:
} catch (e: Throwable) {
            val psiFile = (file.fileEntry as? PsiIrFileEntry)?.psiFile
            CodegenUtil.reportBackendException(e, "psi2ir", psiFile?.virtualFile?.path ?: psiFile?.name ?: file.fileEntry.name)
        }
    }

Response:
private val descriptorGenerator = SyntheticDeclarationsGenerator(context)
    private val symbolTable = context.symbolTable

    override fun visitElement(element: IrElement) {
        element.acceptChildrenVoid(this)
    }

    override fun visitCall(expression: IrCall) {
        expression.acceptChildrenVoid(this)
    }<|endoftext|>


Prompt:
override fun condJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
                if (jumpIfFalse) {
                    genJumpIfFalse(v, jumpLabel)
                } else {
                    genJumpIfTrue(v, jumpLabel)
                }
            }

            private fun genJumpIfTrue(v: InstructionAdapter, jumpLabel: Label) {

Response:
// if (arg is in range) goto jumpLabel

                frameMap.useTmpVar(operandType) { arg1Var ->
                    val exitLabel1 = Label()
                    val exitLabel2 = Label()

                    boundedValue.putHighLow(v, operandType)

                    arg1.put(operandType, v)
                    v.store(arg1Var, operandType)<|endoftext|>


Prompt:
expression.transformChildrenVoid(this)

        val currentList = mutableListOf<IrExpression>()
        val segments = mutableListOf<IrExpression>()

        val arrayInfo = InlineClassArrayInfo(context, expression.varargElementType, expression.type)

        for (e in expression.elements) {
            when (e) {
                is IrSpreadElement -> {

Response:
if (currentList.isNotEmpty()) {
                        segments.add(arrayInfo.toPrimitiveArrayLiteral(currentList))
                        currentList.clear()
                    }
                    segments.add(arrayInfo.unboxElementIfNeeded(e.expression))
                }

                is IrExpression -> {
                    currentList.add(arrayInfo.unboxElementIfNeeded(e))
                }<|endoftext|>


Prompt:
): KotlinCoreEnvironment? {
        if (messageCollector.hasErrors()) return null

        val environment = KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)

        val sourceFiles = environment.getSourceFiles()
        configuration[CLIConfigurationKeys.PERF_MANAGER]?.notifyCompilerInitialized(

Response:
sourceFiles.size, environment.countLinesOfCode(sourceFiles), targetDescription
        )

        return if (messageCollector.hasErrors()) null else environment
    }

    override fun setupPlatformSpecificArgumentsAndServices(
        configuration: CompilerConfiguration, arguments: K2JVMCompilerArguments, services: Services
    ) {
        with(configuration) {<|endoftext|>


Prompt:
object None : SourceSetTreeClassifier() {
        override fun toString(): String = "None"
    }

    @ExternalKotlinTargetApi
    data class Value(val tree: SourceSetTree) : SourceSetTreeClassifier()

    @ExternalKotlinTargetApi
    data class Name(val name: String) : SourceSetTreeClassifier()

Response:
@ExternalKotlinTargetApi
    class Property(val property: org.gradle.api.provider.Property<SourceSetTree>) : SourceSetTreeClassifier() {
        override fun toString(): String {
            return property.toString()
        }
    }

    internal suspend fun classify(compilation: KotlinCompilation<*>): SourceSetTree? {
        return when (this) {<|endoftext|>


Prompt:
* Returns a list containing only the non-null results of applying the given [transform] function
 * to each element in the original collection.
 *
 * @sample samples.collections.Collections.Transformations.mapNotNull
 */
public inline fun <T, R : Any> Iterable<T>.mapNotNull(transform: (T) -> R?): List<R> {

Response:
return mapNotNullTo(ArrayList<R>(), transform)
}

/**
 * Applies the given [transform] function to each element in the original collection
 * and appends only the non-null results to the given [destination].
 */<|endoftext|>


Prompt:
@kotlin.SinceKotlin(version = "1.1")
@kotlin.internal.InlineOnly
public inline fun minOf(a: kotlin.Long, b: kotlin.Long, c: kotlin.Long): kotlin.Long

@kotlin.SinceKotlin(version = "1.4")

Response:
public fun minOf(a: kotlin.Long, vararg other: kotlin.Long): kotlin.Long

@kotlin.SinceKotlin(version = "1.1")
@kotlin.internal.InlineOnly
public inline fun minOf(a: kotlin.Short, b: kotlin.Short): kotlin.Short<|endoftext|>


Prompt:
}
        assertEquals(expected, namesBottomUp, "Bottom-up walk results differ")
    }

    @Test fun withDirectoryFilter() {
        val basedir = createTestFiles()
        try {
            // Every directory ended with 3 and its content is filtered out
            fun filter(file: File): Boolean = !file.name.endsWith("3")

Response:
val referenceNames = listOf("", "1", "1/2", "6", "7.txt", "8", "8/9.txt").map { File(it).path }.toSet()
            compareWalkResults(referenceNames, basedir, ::filter)
        } finally {
            basedir.deleteRecursively()
        }
    }

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


Prompt:
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.RedundantExplicitType

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

Response:
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.RedundantSingleExpressionStringTemplate

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


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

Response:
maxValue = v
        }
    }
    return maxValue
}

/**
 * Returns the largest value among all values produced by [selector] function
 * applied to each element in the array or `null` if there are no elements.
 *
 * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.
 */
@SinceKotlin("1.4")<|endoftext|>


Prompt:
val jsQualifierFqn = FqName("kotlin.js.JsQualifier")
    val jsExportFqn = FqName("kotlin.js.JsExport")
    val jsImplicitExportFqn = FqName("kotlin.js.JsImplicitExport")
    val jsExportIgnoreFqn = FqName("kotlin.js.JsExport.Ignore")

Response:
val jsNativeGetter = FqName("kotlin.js.nativeGetter")
    val jsNativeSetter = FqName("kotlin.js.nativeSetter")
    val jsNativeInvoke = FqName("kotlin.js.nativeInvoke")
    val jsFunFqn = FqName("kotlin.js.JsFun")<|endoftext|>


Prompt:
name = "kotlin-library"
                    podfile = project.file("ios-app/Podfile")
                """.trimIndent()
            )

            buildAndFailWithCocoapodsWrapper(podInstallTaskName) {
                assertOutputContains(missingPodExecutableInPath)
            }

            projectPath.resolve("local.properties")

Response:
.also { if (!it.exists()) it.createFile() }
                .apply {
                    append("\n")
                    appendText(
                        """
                            kotlin.apple.cocoapods.bin=${podPath}
                        """.trimIndent()
                    )
                }

            buildWithCocoapodsWrapper(podInstallTaskName) {<|endoftext|>


Prompt:
val mit = MIt()
    val arrayList = ArrayList<String>()

    asFailsWithCCE("it as MutableIterable") { it as MutableIterable<*> }
    asSucceeds("mit as MutableIterable") { mit as MutableIterable<*> }

Response:
asSucceeds("arrayList as MutableIterable") { arrayList as MutableIterable<*> }

    val coll = C() as Any
    val mcoll = MC()

    asFailsWithCCE("coll as MutableIterable") { coll as MutableIterable<*> }
    asFailsWithCCE("coll as MutableCollection") { coll as MutableCollection<*> }<|endoftext|>


Prompt:
return CallComputation(ESBooleanType, or.functor.invokeWithArguments(left, right))
    }

    override fun visitVariable(esVariable: ESVariable): Computation = substitutions[esVariable] ?: esVariable

    override fun visitConstant(esConstant: ESConstant): Computation = esConstant

Response:
override fun visitReceiver(esReceiver: ESReceiver): ESReceiver = esReceiver

    override fun visitLambda(lambda: ESValue): Computation = lambda
}<|endoftext|>


Prompt:
builder.register(IncrementalResultsConsumer::class.java, RemoteIncrementalResultsConsumer(facade, eventManager, rpcProfiler))
        }
        if (facade.hasIncrementalDataProvider()) {
            builder.register(IncrementalDataProvider::class.java, RemoteIncrementalDataProvider(facade, rpcProfiler))
        }

        return builder.build()
    }

Response:
override fun leaseReplSession(
        aliveFlagPath: String?,
        compilerArguments: Array<out String>,
        compilationOptions: CompilationOptions,
        servicesFacade: CompilerServicesFacadeBase,
        templateClasspath: List<File>,
        templateClassName: String,
    ): CompileService.CallResult<Int> = ifAlive(minAliveness = Aliveness.Alive) {<|endoftext|>


Prompt:
val test = Test(P1(""), P1("My"), Sealed1(1), Sealed1(5))
    test.writeToParcel(parcel, 0)

    val bytes = parcel.marshall()
    parcel.unmarshall(bytes, 0, bytes.size)
    parcel.setDataPosition(0)

Response:
val test2 = parcelableCreator<Test>().createFromParcel(parcel)
    assert(test == test2)
}<|endoftext|>


Prompt:
private var _functionFactory: IrAbstractDescriptorBasedFunctionFactory? = null
    var functionFactory: IrAbstractDescriptorBasedFunctionFactory
        get() =
            synchronized(this) {
                if (_functionFactory == null) {
                    _functionFactory = IrDescriptorBasedFunctionFactory(this, symbolTable, typeTranslator)
                }
                _functionFactory!!
            }
        set(value) {

Response:
synchronized(this) {
                if (_functionFactory != null) {
                    error("functionFactory already set")
                } else {
                    _functionFactory = value
                }
            }
        }

    override val irFactory: IrFactory = symbolTable.irFactory

    private val builtInsModule = builtIns.builtInsModule<|endoftext|>


Prompt:
val midVal = get(mid)
        val cmp = comparison(midVal)

        if (cmp < 0)
            low = mid + 1
        else if (cmp > 0)
            high = mid - 1
        else
            return mid // key found
    }
    return -(low + 1)  // key not found
}

/**
 * Checks that `from` and `to` are in

Response:
* the range of [0..size] and throws an appropriate exception, if they aren't.
 */
private fun rangeCheck(size: Int, fromIndex: Int, toIndex: Int) {
    when {
        fromIndex > toIndex -> throw IllegalArgumentException("fromIndex ($fromIndex) is greater than toIndex ($toIndex).")<|endoftext|>


Prompt:
override fun hashCode() =
        identityHashCode

    override fun toString() =
        ref.get()?.toString() ?: "<null>"
}

internal fun Class<*>.getOrCreateModule(): RuntimeModuleData {
    val classLoader = this.safeClassLoader

    val key = WeakClassLoaderBox(classLoader)

    val cached = moduleByClassLoader[key]

Response:
if (cached != null) {
        cached.get()?.let { return it }
        moduleByClassLoader.remove(key, cached)
    }

    val module = RuntimeModuleData.create(classLoader)
    try {
        while (true) {
            val ref = moduleByClassLoader.putIfAbsent(key, WeakReference(module)) ?: return module<|endoftext|>


Prompt:
* subtype = List<...>
     * result = List<*>, some arguments were not inferred, replaced with '*'
     */
    @JvmStatic
    fun findStaticallyKnownSubtype(supertype: KotlinType, subtypeConstructor: TypeConstructor): TypeReconstructionResult {
        assert(!supertype.isMarkedNullable) { "This method only makes sense for non-nullable types" }

Response:
// Assume we are casting an expression of type Collection<Foo> to List<Bar>
        // First, let's make List<T>, where T is a type variable
        val descriptor = subtypeConstructor.declarationDescriptor ?: error("Can't create default type for " + subtypeConstructor)
        val subtypeWithVariables = descriptor.defaultType<|endoftext|>


Prompt:
fun outer() {
    fun test1(): Int = <!TYPE_MISMATCH_DUE_TO_EQUALS_LAMBDA_IN_FUN!>{ <!RETURN_NOT_ALLOWED!>return<!> 1 }<!>

Response: fun test2(): Int = <!TYPE_MISMATCH_DUE_TO_EQUALS_LAMBDA_IN_FUN!>{ 1 }<!><|endoftext|>


Prompt:
// WITH_STDLIB

import kotlin.test.assertEquals

class C(val expected: Int) {
    fun memberVararg(i: Int, vararg s: String) {
        assertEquals(expected, i)
        assertEquals(0, s.size)
    }

    fun memberDefault(i: Int, s: String = "") {
        assertEquals(expected, i)

Response:
assertEquals("", s)
    }

    fun memberBoth(i: Int, s: String = "", vararg t: String) {
        assertEquals(expected, i)
        assertEquals("", s)
        assertEquals(0, t.size)
    }
}

fun C.extensionVararg(i: Int, vararg s: String) {<|endoftext|>


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

import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.config.AnalysisFlags
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter

Response:
import org.jetbrains.kotlin.fir.analysis.checkers.MppCheckerKind
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.checkers.fullyExpandedClassId
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression<|endoftext|>


Prompt:
} else {
                                              CommandFallback.Error(sharedHandleError(podInstallCommand, result))
                                          }
                                      },
                                      processConfiguration = {
                                          directory(workingDir.get())
                                          // CocoaPods requires to be run with Unicode external encoding
                                          environment().putIfAbsent("LC_ALL", "en_US.UTF-8")
                                      })
    }

Response:
private fun sharedHandleError(podInstallCommand: List<String>, result: RunProcessResult): String? {
        val command = podInstallCommand.joinToString(" ")
        val output = result.stdErr.ifBlank { result.stdOut }

        var message = """
            |'$command' command failed with an exception:
            | stdErr: ${result.stdErr}<|endoftext|>


Prompt:
OBJECT_PARAMETER_GENERIC("Ljava/lang/Object;", true)
    }

    companion object {
        fun getSpecialSignatureInfo(builtinSignature: String): SpecialSignatureInfo {
            if (builtinSignature in ERASED_COLLECTION_PARAMETER_SIGNATURES) return SpecialSignatureInfo.ONE_COLLECTION_PARAMETER

Response:
val defaultValue = SIGNATURE_TO_DEFAULT_VALUES_MAP.getValue(builtinSignature)

            return if (defaultValue == TypeSafeBarrierDescription.NULL) {
                // return type is some generic type as 'Map.get'
                SpecialSignatureInfo.OBJECT_PARAMETER_GENERIC
            } else<|endoftext|>


Prompt:
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.cli.common.extensions.ScriptEvaluationExtension
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity

Response:
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.scripting.configuration.ScriptingConfigurationKeys<|endoftext|>


Prompt:
fun <T> shareTypeInfo(from: T, to: T) {}
            val buildee = build {
                shareTypeInfo(0x13, materialize())
            }
            checkExactType<Buildee<Int>>(buildee)
        }
        fun test3() {
            fun <T> shareTypeInfo(from: T, to: T) {}
            val buildee = build {

Response:
shareTypeInfo(0b1000, materialize())
            }
            checkExactType<Buildee<Int>>(buildee)
        }

        test1()
        test2()
        test3()
    }

    testBasicCase()
    testLiterals()
}

fun box(): String {
    testYield()
    testMaterialize()
    return "OK"
}<|endoftext|>


Prompt:
if (test3(p = *arrayOf<String>("1")) != "1") return "fail 29"
    if (test3(p = *arrayOf<String>("1", "2")) != "12") return "fail 30"

    return "OK"
}

fun test1(vararg p: Int): String {
    var result = ""
    for (i in p) {
        result += i

Response:
}
    return result
}

fun test2(vararg p: String): String {
    var result = ""
    for (i in p) {
        result += i
    }
    return result
}

fun <T> test3(vararg p: T): String {
    var result = ""
    for (i in p) {
        result += i
    }
    return result
}<|endoftext|>


Prompt:
},
                        valueParameter.returnTypeRef,
                        extractedAnnotations = valueParameter.annotations
                    )
                    if (multiDeclaration != null) {
                        addDestructuringStatements(
                            statements,
                            baseModuleData,
                            multiDeclaration,
                            firLoopParameter,
                            tmpVariable = true,
                            forceLocal = true,
                        )
                    } else {

Response:
statements.add(firLoopParameter)
                    }
                    statements += convertLoopBody(blockNode)
                }
            }
        }
    }

    /**
     * @see org.jetbrains.kotlin.parsing.KotlinExpressionParsing.parseLoopBody<|endoftext|>


Prompt:
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.sam.SAM_LOOKUP_NAME

//TODO(valtman) Should be in gradle daemon.
class AbiSnapshotDiffService() {

    companion object {
        //Store list of changed lookups

Response:
private val diffCache: MutableMap<Pair<AbiSnapshot, AbiSnapshot>, DirtyData> = mutableMapOf()

        //TODO(valtman) move out from Kotlin daemon
        fun compareJarsInternal(
            oldSnapshot: AbiSnapshot, newSnapshot: AbiSnapshot,
            caches: IncrementalCacheCommon<|endoftext|>


Prompt: <!USELESS_IS_CHECK!>this@case_5 is ClassLevel1<!> && this@case_5_1_1 is Float)

Response: }<|endoftext|>


Prompt:
throw UnsupportedOperationException()
    }

    override fun remove(o: Int) = true

    override fun removeAt(index: Int): Int = 123

    override fun addAll(c: Collection<Int>): Boolean {
        throw UnsupportedOperationException()
    }

    override fun addAll(index: Int, c: Collection<Int>): Boolean {
        throw UnsupportedOperationException()

Response:
}

    override fun removeAll(c: Collection<Int>): Boolean {
        throw UnsupportedOperationException()
    }

    override fun retainAll(c: Collection<Int>): Boolean {
        throw UnsupportedOperationException()
    }

    override fun clear() {
        throw UnsupportedOperationException()
    }

    override fun set(index: Int, element: Int): Int {<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_EXPRESSION

interface Bound1
interface Bound2
object First : Bound1, Bound2
object Second : Bound1, Bound2

fun <S : Bound1> intersect(vararg elements: S): S = TODO()

fun topLevelFunction() = intersect(First, Second)

Response:
val Any.extensionProperty
    get() = intersect(First, Second)

fun Any.extensionFunction() = intersect(First, Second)

class Cls {
    val publicProperty = intersect(First, Second)
    private val privateProperty = intersect(First, Second)

    fun publicMemberFunction() = intersect(First, Second)
    private fun privateMemberFunction() = intersect(First, Second)<|endoftext|>


Prompt:
package org.jetbrains.kotlin.cfg.pseudocode

import com.google.common.collect.HashMultimap
import com.google.common.collect.Multimap
import com.intellij.util.containers.BidirectionalMap
import org.jetbrains.kotlin.cfg.Label

Response:
import org.jetbrains.kotlin.cfg.pseudocode.instructions.*
import org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.MagicInstruction
import org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.MagicKind<|endoftext|>


Prompt:
fun f2(x: I1) = x.k

// MODULE: platform()()(common)
// FILE: platform.kt

actual open class C1 {
    actual fun o() = "O"

    actual val k = "K"
}

actual interface I1 {
    actual fun o(): String

    actual val k: String
}

Response: fun box() = f1(C()) + f2(C())<|endoftext|>


Prompt:
* NUMBER: 1
 * DESCRIPTION: Check Elvis evaluation
 */

fun box(): String {
    val x: Boolean? = null ?: getNull(null) ?: A().b ?: getTrue() ?: false
    val s = null == getNull(null) ?: !getNullableTrue()!! || getFalse() ?: false

Response:
val k = ((getNull(null)?: getNull(null) ) ?: getNull(true)) ?: getFalse()
    try {
        val y = null ?: throw ExcA()
    } catch (e: ExcA) {

        if ((x == true && !s && k!!)) return "OK"
    }

    return "NOK"
}
fun getTrue() = true<|endoftext|>


Prompt:
val library = buildNativeLibraryFrom(defFile, files.directory)
        val index = buildNativeIndex(library, false).index

        index.objCClasses.find { it.name == "Foo" }.let { cls ->
            assertNotNull(cls, "Class 'Foo' not found in native library $library")

Response:
assertNotNull(cls.methods.find { it.selector == "direct" && it.isClass && it.isDirect })
            assertNotNull(cls.methods.find { it.selector == "direct" && !it.isClass && it.isDirect })
        }<|endoftext|>


Prompt:
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
import org.jetbrains.kotlin.test.directives.configureFirParser
import org.jetbrains.kotlin.test.model.BinaryKind
import org.jetbrains.kotlin.test.model.DependencyKind

Response:
import org.jetbrains.kotlin.test.model.FrontendKind
import org.jetbrains.kotlin.test.model.FrontendKinds
import org.jetbrains.kotlin.test.preprocessors.IrInterpreterImplicitKotlinImports
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerWithTargetBackendTest<|endoftext|>


Prompt:
(<!UNRESOLVED_REFERENCE!><!SYNTAX!><!>*<!>a<!SYNTAX!>)<!><!SYNTAX!><!> <!SYNTAX!><!>-> {}
    }
}

fun testWithSubject_bad_4(b: B) {
    var x = b
    // bad
    when (b) {

Response:
<!ASSIGNMENT_IN_EXPRESSION_CONTEXT!>x = b<!> -> {}
        <!ASSIGNMENT_IN_EXPRESSION_CONTEXT!>b += b<!> -> {}
        <!ASSIGNMENT_IN_EXPRESSION_CONTEXT!>b -= b<!> -> {}<|endoftext|>


Prompt:
@kotlin.internal.InlineOnly
public inline fun UShortArray.indexOfLast(predicate: (UShort) -> Boolean): Int {
    return storage.indexOfLast { predicate(it.toUShort()) }
}

/**
 * Returns the last element.
 *
 * @throws NoSuchElementException if the array is empty.
 *

Response:
* @sample samples.collections.Collections.Elements.last
 */
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly
public inline fun UIntArray.last(): UInt {
    return storage.last().toUInt()
}

/**
 * Returns the last element.
 *<|endoftext|>


Prompt:
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER

import kotlin.reflect.KCallable

class Foo {
    fun <T> installRoute(handler: T) where T : (String) -> Any?, T : KCallable<*> {
    }

Response:
fun <T> installRoute(handler: T) where T : () -> Any?, T : KCallable<*> {
    }

    fun foo() {
        <!NONE_APPLICABLE!>installRoute<!><Any>(::route)
    }

}

fun route(s: String): Any? = null<|endoftext|>


Prompt:
fun set4(a: Double, v: String): Any<!> = 1

            <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
            fun set5(a: Double, v: String): CharSequence<!> = "OK"

            companion object {

Response:
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
                fun set(a: String, v: Any?): Any?<!> = null

                <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter<|endoftext|>


Prompt:
<!DSL_SCOPE_VIOLATION!>a<!>()
            b()
            bar2 {
                <!DSL_SCOPE_VIOLATION!>a<!>()
                b()
            }
        }

        bar2 {
            a()
            b()
        }
    }

    foo2 {
        a()

        bar1 {
            a()

Response:
b()
            bar2 {
                <!DSL_SCOPE_VIOLATION!>a<!>()
                b()
            }
        }

        bar2 {
            <!DSL_SCOPE_VIOLATION!>a<!>()
            b()
        }
    }

    bar1 {
        b()
        bar2 {
            b()
        }
    }<|endoftext|>


Prompt:
@Deprecated("Use CharArray.concatToString(startIndex, endIndex) instead", ReplaceWith("chars.concatToString(offset, offset + length)"))
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
public actual fun String(chars: CharArray, offset: Int, length: Int): String {

Response:
if (offset < 0 || length < 0 || offset + length > chars.size)
        throw IndexOutOfBoundsException()

    val copy = WasmCharArray(length)
    copyWasmArray(chars.storage, copy, offset, 0, length)
    return copy.createString()
}

/**
 * Concatenates characters in this [CharArray] into a String.
 */<|endoftext|>


Prompt:
if (this is FirPropertyAccessor && visibility == propertySymbol.visibility) return false
        if (this !is FirMemberDeclaration || visibility != Visibilities.Private) return false

        val containingDeclaration = getContainingClassSymbol(session) ?: return false
        return isNativeOrEffectivelyExternal(containingDeclaration, session)
    }

Response:
private fun FirDeclaration.isNonAbstractMemberIfInterface(session: FirSession): Boolean {
        return this is FirCallableDeclaration
                && modality != Modality.ABSTRACT
                && (getContainingClassSymbol(session) as? FirClassSymbol<*>)?.classKind == ClassKind.INTERFACE
                && this !is FirPropertyAccessor
    }<|endoftext|>


Prompt:
if (Modifier.STATIC in this) {
                JavaVisibilities.ProtectedStaticVisibility
            } else {
                JavaVisibilities.ProtectedAndPackage
            }
        }
        else -> JavaVisibilities.PackageVisibility
    }

internal fun TypeElement.computeClassId(): ClassId? {
    val enclosingElement = enclosingElement

Response:
if (enclosingElement.kind != ElementKind.PACKAGE) {
        val parentClassId = (enclosingElement as TypeElement).computeClassId() ?: return null
        return parentClassId.createNestedClassId(Name.identifier(simpleName.toString()))
    }

    return ClassId.topLevel(FqName(qualifiedName.toString()))
}<|endoftext|>