prompt
stringlengths 1
924
| completion
stringlengths 14
937
|
---|---|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!>.propNullableAny
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!>.funT()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!>.funAny() | <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!>.funNullableT()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!>.funNullableAny()
}
}
// TESTCASE NUMBER: 23
fun case_23(a: ((Float) -> Int?)?, b: Float?) {<|endoftext|> |
buildTypes: Collection<NativeBuildType> = NativeBuildType.DEFAULT_BUILD_TYPES,
configure: Action<Framework>
) = framework(buildTypes) { configure.execute(this) }
/** Creates a test executable with the given [namePrefix] for each build type and configures it. */
@JvmOverloads
fun test(
namePrefix: String, | buildTypes: Collection<NativeBuildType> = NativeBuildType.DEFAULT_BUILD_TYPES,
configure: TestExecutable.() -> Unit = {}
) = createBinaries(namePrefix, namePrefix, NativeOutputKind.TEST, buildTypes, ::TestExecutable, configure)
/** Creates a test executable with the empty name prefix for each build type and configures it. */<|endoftext|> |
// test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1, $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$baz\1\30:int=0:int, | $i$f$foo\2\115:int=0:int, $i$a$-suspendCoroutineUninterceptedOrReturn-TestKt$foo$2\3\116\2:int=0:int, $i$f$bar\4\117:int=0:int, c\4:int=1:int,<|endoftext|> |
public inline fun <R : Comparable<R>> IntArray.maxOfOrNull(selector: (Int) -> R): R? {
if (isEmpty()) return null
var maxValue = selector(this[0])
for (i in 1..lastIndex) {
val v = selector(this[i])
if (maxValue < v) {
maxValue = v
}
} | return maxValue
}
/**
* Returns the largest value among all values produced by [selector] function
* applied to each element in the array or `null` if there are no elements.
*/
@SinceKotlin("1.4")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType<|endoftext|> |
/**
* Returns a user-defined unhandled exception hook set by [setUnhandledExceptionHook] or `null` if no user-defined hooks were set.
*/
@ExperimentalNativeApi
@SinceKotlin("1.6")
@OptIn(FreezingIsDeprecated::class)
public fun getUnhandledExceptionHook(): ReportUnhandledExceptionHook? { | return UnhandledExceptionHookHolder.hook.value
}
/**
* Performs the default processing of unhandled exception.
*
* If user-defined hook set by [setUnhandledExceptionHook] is present, calls it and returns.
* If the hook is not present, calls [terminateWithUnhandledException] with [throwable].<|endoftext|> |
if (f != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>f<!>.funAny()
if (f != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any?")!>f<!>.funNullableT() | if (f != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any?")!>f<!>.funNullableAny()
if (f != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any?")!>f<!><|endoftext|> |
1140, 1142, 1144, 1146, 1148, 1150, 1152, 1154, 1156, 1158, 1160, 1162, 1164, 1166, 1168, 1170,
1172, 1174, 1176, 1178, 1181, 1184, 1187, 1190, 1193, 1196, 1199, 1202, 1205, 1208, 1211, 1214, | 1217, 1220, 1223, 1226, 1229, 1232, 1235, 1238, 1240, 1242, 1244, 1246, 1248, 1250, 1253, 1256,
1259, 1262, 1265, 1268, 1271, 1274, 1277, 1280, 1282, 1284, 1286, 1288, 1290, 1292, 1294, 1296,<|endoftext|> |
for (i in uintProgression step one()) {
}
return "OK"
}
// For "step" progressions in JVM IR, a call to getProgressionLastElement() is made to compute the "last" value.
// If "step" is called on a non-literal progression, there is a check to see if that progression's step value is < 0. | // If the step is non-constant, there is a check that it is > 0, and if not, an IllegalArgumentException is thrown.
// 0 iterator
// 0 getStart
// 0 getEnd
// 1 getFirst
// 1 getLast
// 1 getStep
// 1 INVOKESTATIC kotlin/internal/UProgressionUtilKt.getProgressionLastElement<|endoftext|> |
@NullUnmarked
public String nullUnmarkedProduce();
@NullUnmarked
public void nullUnmarkedConsume(String arg);
}
// FILE: nullmarkedpackage/UnannotatedTypeWithNullUnmarkedConstructor.java
package nullmarkedpackage;
import org.jspecify.annotations.*;
public class UnannotatedTypeWithNullUnmarkedConstructor {
@NullUnmarked | public UnannotatedTypeWithNullUnmarkedConstructor(String arg) {}
}
// FILE: kotlin.kt
interface TestA: nullmarkedpackage.NullUnmarkedType {
override fun unannotatedProduce(): String?
}
interface TestB: nullmarkedpackage.UnannotatedType {
override fun nullUnmarkedProduce(): String?
}
fun test(<|endoftext|> |
* Source element from which the value was created. May be null for constants from non-source files.
*/
public abstract val sourcePsi: KtElement?
/**
* Constant value represented as Kotlin code. E.g: `1`, `2f, `3u` `null`, `"str"`
*/
public abstract fun renderAsKotlinConstant(): String | public class KtNullConstantValue(override val sourcePsi: KtElement?) : KtConstantValue(ConstantValueKind.Null) {
override val value: Nothing? get() = null
override fun renderAsKotlinConstant(): String = "null"
}
public class KtBooleanConstantValue(
override val value: Boolean,<|endoftext|> |
import org.jetbrains.kotlin.types.UnwrappedType
// stateless component
interface KotlinResolutionStatelessCallbacks {
fun isDescriptorFromSource(descriptor: CallableDescriptor): Boolean
fun isInfixCall(kotlinCall: KotlinCall): Boolean
fun isOperatorCall(kotlinCall: KotlinCall): Boolean | fun isSuperOrDelegatingConstructorCall(kotlinCall: KotlinCall): Boolean
fun isHiddenInResolution(
descriptor: DeclarationDescriptor, kotlinCallArgument: KotlinCallArgument, resolutionCallbacks: KotlinResolutionCallbacks
): Boolean
fun isHiddenInResolution(<|endoftext|> |
public inline val ScrollLogicalPosition.Companion.CENTER: ScrollLogicalPosition get() = "center".asDynamic().unsafeCast<ScrollLogicalPosition>()
public inline val ScrollLogicalPosition.Companion.END: ScrollLogicalPosition get() = "end".asDynamic().unsafeCast<ScrollLogicalPosition>() | public inline val ScrollLogicalPosition.Companion.NEAREST: ScrollLogicalPosition get() = "nearest".asDynamic().unsafeCast<ScrollLogicalPosition>()
/* please, don't implement this interface! */
@JsName("null")
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
public external interface CSSBoxType {
companion object
}<|endoftext|> |
true -> 2
}
<!NO_ELSE_IN_WHEN!>when<!> {
true -> 2
}
} catch (e: Exception) {
when {
true -> 3
}
<!NO_ELSE_IN_WHEN!>when<!> {
true -> 3
}
} catch (e: Throwable) {
when { | true -> 4
}
<!NO_ELSE_IN_WHEN!>when<!> {
true -> 4
}
} finally {
when {
true -> 5
}
when {
true -> 5
}
}
fun whenBlock() = try {
when {
true -> {
2
}
}<|endoftext|> |
return inlineX.foo({ z: Int -> "" + z}, 25, { -> this.length })
}
fun box(): String {
if (test1() != 2) return "test1: ${test1()}"
return "OK"
}
// FILE: bar.kt
package foo
class Inline() { | inline fun foo(closure1 : (l: Int) -> String, param: Int, closure2: String.() -> Int) : Int {
return closure1(param).closure2()
}
}<|endoftext|> |
<!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T: UserInterfaceA> testTypeParameterWithMultipleTypeAliasedUpperBoundsABC(arg: Invariant<T>)<!> where T: UserInterfaceB {} | <!CONFLICTING_OVERLOADS!>fun <T: UserInterfaceA> testTypeParameterWithMultipleTypeAliasedUpperBoundsABC(arg: Invariant<T>)<!> where T: SameUserInterfaceB {}<|endoftext|> |
x?.value {}
x?.value<!UNSAFE_CALL!>.<!>invoke({})
}
// Test case 2: additional receiver, non-generic invoke
class Foo2<T>
class Bar2<T>(val value: Foo2<T>)
class Another2 {
operator fun Foo2<String>.invoke(x: Int) {}
} | fun Another2.main(x: Bar2<String>?) {
x?.value(1)
x?.value<!UNSAFE_CALL!>.<!>invoke(1)
}
// Test case 3: additional generic receiver, generic invoke
class Foo3<T>
class Bar3<T>(val value: Foo3<T>)
class Another3<T> {<|endoftext|> |
for (element in this) if (element != null) destination.add(element)
return destination
}
/**
* Appends all elements not matching the given [predicate] to the given [destination].
*
* The operation is _terminal_.
*
* @sample samples.collections.Collections.Filtering.filterTo
*/ | public inline fun <T, C : MutableCollection<in T>> Sequence<T>.filterNotTo(destination: C, predicate: (T) -> Boolean): C {
for (element in this) if (!predicate(element)) destination.add(element)
return destination
}
/**
* Appends all elements matching the given [predicate] to the given [destination].
*
* The operation is _terminal_.<|endoftext|> |
package org.jetbrains.kotlin.backend.common.serialization.mangle.ir
import org.jetbrains.kotlin.backend.common.serialization.mangle.AbstractKotlinMangler
import org.jetbrains.kotlin.backend.common.serialization.mangle.MangleMode | import org.jetbrains.kotlin.backend.common.serialization.mangle.SpecialDeclarationType
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.util.KotlinMangler<|endoftext|> |
if (a.x !== null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char"), DEBUG_INFO_SMARTCAST!>a.x<!>.funAny()
if (a.x !== null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char & kotlin.Char?")!>a.x<!>.funNullableT() | if (a.x !== null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char & kotlin.Char?")!>a.x<!>.funNullableAny()
if (a.x !== null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char & kotlin.Char?")!>a.x<!><|endoftext|> |
if (3.toShort() !in 3 until 1 != !range1.contains(3.toShort())) throw AssertionError()
if (!(3.toShort() in 3 until 1) != !range1.contains(3.toShort())) throw AssertionError() | if (!(3.toShort() !in 3 until 1) != range1.contains(3.toShort())) throw AssertionError()
// no local optimizations
if (element17 in 3 until 1 != range1.contains(element17)) throw AssertionError()
if (element17 !in 3 until 1 != !range1.contains(element17)) throw AssertionError()<|endoftext|> |
override fun spawn(arguments: List<String>, setupConfiguration: CompilerConfiguration.() -> Unit) {
val spawnedArguments = K2NativeCompilerArguments()
parseCommandLineArguments(arguments, spawnedArguments)
val spawnedConfiguration = CompilerConfiguration() | spawnedConfiguration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY))
spawnedConfiguration.put(IrMessageLogger.IR_MESSAGE_LOGGER, configuration.getNotNull(IrMessageLogger.IR_MESSAGE_LOGGER))<|endoftext|> |
import org.jetbrains.kotlin.fir.builder.toMutableOrEmpty
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.impl.FirScriptImpl
import org.jetbrains.kotlin.fir.expressions.FirAnnotation | import org.jetbrains.kotlin.fir.symbols.impl.FirScriptSymbol
import org.jetbrains.kotlin.name.Name
@FirBuilderDsl
class FirScriptBuilder : FirAnnotationContainerBuilder {
override var source: KtSourceElement? = null
var resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR<|endoftext|> |
package org.jetbrains.kotlin.analysis.low.level.api.fir.element.builder
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
import org.jetbrains.kotlin.fir.FirElement
import org.jetbrains.kotlin.fir.render | import org.jetbrains.kotlin.psi.KtElement
class DuplicatedFirSourceElementsException(
existingFir: FirElement,
newFir: FirElement,
psi: KtElement
) : IllegalStateException() {
override val message: String? = """|The PSI element should be used only once as a real PSI source of FirElement,<|endoftext|> |
// JVM_ABI_K1_K2_DIFF: KT-63864
// WITH_STDLIB
import kotlin.test.*
val sb = StringBuilder()
fun box(): String {
val str = "captured"
foo {
sb.appendLine(it)
sb.appendLine(str)
}
assertEquals("""
42 | captured
""".trimIndent(), sb.toString())
return "OK"
}
fun foo(f: (Int) -> Unit) {
f(42)
}<|endoftext|> |
override fun check(expression: FirSafeCallExpression, context: CheckerContext, reporter: DiagnosticReporter) {
val receiverType = EnhancedForWarningConeSubstitutor(context.session.typeContext)
.substituteOrNull(expression.receiver.resolvedType)
?.fullyExpandedType(context.session) ?: return | checkSafeCallReceiverType(receiverType, expression.source, context, reporter)
}
}<|endoftext|> |
return "binarySearchRange(${strategy.rangeRef("decodedRangeStart")}, $charCode)"
}
override fun startAt(index: String): String {
return "${strategy.rangeRef("decodedRangeStart")}[$index]"
}
override fun categoryAt(index: String): String { | return "${strategy.rangeRef("decodedRangeCategory")}[$index]"
}
}<|endoftext|> |
assertEquals("abc, def, ghi", arrayOf("abc", "def", "ghi").joinToString())
assertEquals("1, 2, 3", arrayOf(1, 2, 3).joinToString())
assertEquals("4, 5, 6", arrayOf(4.toLong(), 5.toLong(), 6.toLong()).joinToString()) | assertEquals("7, 8, 9", arrayOf(7.toShort(), 8.toShort(), 9.toShort()).joinToString())
assertEquals("10, 11, 12", arrayOf(10.toByte(), 11.toByte(), 12.toByte()).joinToString())
assertEquals("abc", arrayOf('a', 'b', 'c').joinToString(""))<|endoftext|> |
package org.jetbrains.kotlin.incremental.classpathDiff
import org.jetbrains.kotlin.incremental.ChangesEither
import org.jetbrains.kotlin.incremental.LookupSymbol
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
/** | * Similar to [LookupSymbol] but with information about its kind (i.e., whether it's a [ClassSymbol], [ClassMember], or [PackageMember]).
*/
sealed class ProgramSymbol
data class ClassSymbol(val classId: ClassId) : ProgramSymbol()
data class ClassMember(val classId: ClassId, val memberName: String) : ProgramSymbol()<|endoftext|> |
commonCompilerImpl: FqName,
commonCompilerHelperName: FqName,
jvmOptions: List<KProperty1<*, *>>,
withPrinterToFile: (targetFile: File, Printer.() -> Unit) -> Unit
) { | val jvmImplFqName = FqName("${jvmInterfaceFqName.asString()}$IMPLEMENTATION_SUFFIX")
withPrinterToFile(fileFromFqName(srcDir, jvmImplFqName)) {
generateImpl(
jvmImplFqName,
commonCompilerImpl,
jvmInterfaceFqName,
jvmOptions
)<|endoftext|> |
object : TypeToken<V>() {
fun unused() = forceRegeneration()
}
// FILE: 2.kt
import test.*
fun interface I {
fun foo(): String
}
fun <T> foo() =
I {
typeTokenOf<T>()::class.java.genericSuperclass.toString()
}.foo()
fun box(): String = | foo<String>().let { if (it == "test.TypeToken<T>") "OK" else it }<|endoftext|> |
throw IndexOutOfBoundsException("startIndex: $startIndex, length: $length")
}
if (startIndex > endIndex) {
throw IllegalArgumentException("startIndex($startIndex) > endIndex($endIndex)")
}
}
/**
* Removes the character at the specified [index] from this string builder and returns this instance.
* | * If the `Char` at the specified [index] is part of a supplementary code point, this method does not remove the entire supplementary character.
*
* @param index the index of `Char` to remove.
*
* @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
*/
@SinceKotlin("1.4")<|endoftext|> |
if (<!SENSELESS_COMPARISON!>v != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>v<!>.propAny | if (<!SENSELESS_COMPARISON!>v != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>v<!>.propNullableT<|endoftext|> |
assertEquals(listOf<UShort>(1u, 2u, 3u), ushortArrayOf(1u, 2u, 3u).flatMap { listOf(it) })
assertEquals(listOf<UInt>(1u, 1u, 2u, 2u, 3u, 3u), uintArrayOf(1u, 2u, 3u).flatMap { listOf(it, it) }) | assertEquals(listOf(), ulongArrayOf(1u, 2u, 3u).flatMap { listOf<ULong>() })
}
@Test
fun flatMapIndexed() {
assertEquals(listOf(), ubyteArrayOf().flatMapIndexed { index, _ -> listOf(index) })<|endoftext|> |
if (r4 !is Array<*> || r4[0] !is Array<*> || !(r4[0] as Array<*>).contentEquals(args)) return "Fail 4: $r4"
val r5 = mh.invoke(args)
if (r5 !is Array<*> || !r5.contentEquals(args)) return "Fail 5: $r5" | val r6 = mh.invoke(*args)
if (r6 != "aaa") return "Fail 6: $r6"
val r7 = mh.invoke(arrayOf(args) as Array<*>)<|endoftext|> |
return filterNotTo(ArrayList<UInt>(), predicate)
}
/**
* Returns a list containing all elements not matching the given [predicate].
*
* @sample samples.collections.Collections.Filtering.filter
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly | public inline fun ULongArray.filterNot(predicate: (ULong) -> Boolean): List<ULong> {
return filterNotTo(ArrayList<ULong>(), predicate)
}
/**
* Returns a list containing all elements not matching the given [predicate].
*
* @sample samples.collections.Collections.Filtering.filter
*/
@SinceKotlin("1.3")<|endoftext|> |
import kotlin.ranges.*
import kotlinx.cinterop.*
class C {
val i: Int = null!!
fun v(): IntVarOf<Int> = null!!
fun r(): IntRange = null!!
}
val a: IntArray = null!!
fun p(): IntProgression = null!!
""".trimIndent() | LINUX_ARM64.name withSource """
import kotlin.ranges.*
import kotlinx.cinterop.*
class C {
val i: Long = null!!
fun v(): LongVarOf<Long> = null!!
fun r(): LongRange = null!!
}
val a: LongArray = null!!
fun p(): LongProgression = null!!<|endoftext|> |
fun ControlFlowGraphBuilder.createEqualityOperatorCallNode(fir: FirEqualityOperatorCall): EqualityOperatorCallNode =
EqualityOperatorCallNode(currentGraph, fir, levelCounter)
fun ControlFlowGraphBuilder.createWhenBranchConditionExitNode(fir: FirWhenBranch): WhenBranchConditionExitNode =
WhenBranchConditionExitNode(currentGraph, fir, levelCounter) | fun ControlFlowGraphBuilder.createJumpNode(fir: FirJump<*>): JumpNode =
JumpNode(currentGraph, fir, levelCounter)
fun ControlFlowGraphBuilder.createCheckNotNullCallNode(fir: FirCheckNotNullCall): CheckNotNullCallNode =
CheckNotNullCallNode(currentGraph, fir, levelCounter)<|endoftext|> |
val newResolvedCall = resolvedCall as? NewResolvedCallImpl<*>
?: return expression
val suspendConversionType = newResolvedCall.getExpectedTypeForSuspendConvertedArgument(valueArgument)
?: return expression
val valueParameterType = if (valueParameter.isVararg) valueParameter.varargElementType!! else valueParameter.type | val suspendFunType: KotlinType =
if (context.extensions.samConversion.isSamType(valueParameterType))
valueParameterType.getSubstitutedFunctionTypeForSamType()
else
valueParameterType
val irAdapterRefType = suspendFunType.toIrType()<|endoftext|> |
data class Box(var value: String)
fun box(): String {
val o = Box("lorem")
val prop = Box::value
if (prop.get(o) != "lorem") return "Fail 1: ${prop.get(o)}"
prop.set(o, "ipsum") | if (prop.get(o) != "ipsum") return "Fail 2: ${prop.get(o)}"
if (o.value != "ipsum") return "Fail 3: ${o.value}"
o.value = "dolor"
if (prop.get(o) != "dolor") return "Fail 4: ${prop.get(o)}"<|endoftext|> |
internal val KtClassOrObjectSymbol.implementsCloneable: Boolean
get() {
return superTypes.any {
it.expandedClassSymbol?.isCloneable ?: false
}
}
internal val KtClassOrObjectSymbol.isCloneable: Boolean
get() {
return classIdIfNonLocal?.isCloneable ?: false
} | internal val ClassId.isCloneable: Boolean
get() {
return asSingleFqName() == StandardNames.FqNames.cloneable.toSafe()
}
context(KtAnalysisSession)
internal val KtFunctionSymbol.isClone: Boolean
get() {
val cloneCallableId = CallableId(StandardClassIds.Cloneable, Name.identifier("clone"))<|endoftext|> |
class yield<T: yield<T>>
return@yield
return@yield Unit
val foo5: yield<*>
}
fun yield(i: (Int) -> Unit) {}
// FILE: 2.kt
package p2.yield
import p2.yield.yield
import p2.yield.foo
val yield = 5
fun foo(){} | fun bar(yield: Int = 4) {}
fun yield(yield: Int) {
"$`yield`"
"${`yield`}"
`yield`
val foo = `yield` + `yield`
val foo2 = `yield`
bar(`yield` = 5)
`yield`(4)<|endoftext|> |
import org.jetbrains.kotlin.analysis.test.framework.services.expressionMarkerProvider
import org.jetbrains.kotlin.analysis.test.framework.utils.executeOnPooledThreadInReadAction
import org.jetbrains.kotlin.idea.references.mainReference
import org.jetbrains.kotlin.psi.KtFile | import org.jetbrains.kotlin.psi.KtReferenceExpression
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.assertions
abstract class AbstractSymbolRenderingByReferenceTest : AbstractAnalysisApiBasedTest() {<|endoftext|> |
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.utils.isConst
import org.jetbrains.kotlin.fir.expressions.FirPropertyAccessExpression
import org.jetbrains.kotlin.fir.references.impl.FirPropertyFromParameterResolvedNamedReference | import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.impl.*
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
import org.jetbrains.kotlin.fir.types.ConeDynamicType<|endoftext|> |
const val mutablePropertyGet = <!EVALUATED: `1`!>B::b.get(B(1))<!>
const val mutablePropertySet = <!EVALUATED: `3`!>B(2).apply { B::b.set(this, 3) }.b<!> | const val mutablePropertyInvoke = <!EVALUATED: `4`!>B::b.invoke(B(4))<!>
const val mutablePropertyWithReceiverName = <!EVALUATED: `b`!>B(10)::b.name<!><|endoftext|> |
fun <T> dispatchValue(): T = value as T
}
fun box(): String {
var res = underlying<Int>(IC(40)) + 2
if (res != 42) return "FAIL 1: $res"
res = extension<Int>(IC(40)) + 3
if (res != 43) return "FAIL 2: $res" | res = dispatch<Int>(IC(40)) + 4
if (res != 44) return "FAIL 3: $res"
res = normal<Int>(IC(40)) + 5
if (res != 45) return "FAIL 4: $res"
return "OK"
}<|endoftext|> |
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty
val Int.a by Delegate(<!NO_THIS!>this<!>)
class A {
val Int.a by Delegate(<!TYPE_MISMATCH!>this<!>)
}
class Delegate(i: Int) { | operator fun getValue(t: Any?, p: KProperty<*>): Int {
return 1
}
}<|endoftext|> |
import org.jetbrains.kotlin.backend.konan.renderCompilerError
import org.jetbrains.kotlin.ir.builders.IrBuilderWithScope
import org.jetbrains.kotlin.ir.builders.irCall
import org.jetbrains.kotlin.ir.builders.irCallWithSubstitutedType | import org.jetbrains.kotlin.ir.builders.irString
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrDeclarationBase
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.declarations.IrSymbolOwner<|endoftext|> |
// FILE: 1.kt
package test
public inline fun <R> doCall(block: ()-> R) : R {
return block()
}
// FILE: 2.kt
import test.*
import Kind.*
enum class Kind {
LOCAL,
EXTERNAL,
GLOBAL
}
class Internal(val value: String)
class External(val value: String) | class Global(val value: String)
fun test1(intKind: Kind, extKind: Kind): Global {
var externalResult = doCall ext@ {
val internalResult = doCall int@ {
if (intKind == Kind.GLOBAL) {
return@test1 Global("internal -> global")
} else if (intKind == EXTERNAL) {<|endoftext|> |
@SinceKotlin("1.4")
public expect fun StringBuilder.setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder
/**
* Removes the character at the specified [index] from this string builder and returns this instance.
*
* If the `Char` at the specified [index] is part of a supplementary code point, this method does not remove the entire supplementary character.
* | * @param index the index of `Char` to remove.
*
* @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
*/
@SinceKotlin("1.4")
public expect fun StringBuilder.deleteAt(index: Int): StringBuilder
/**
* Removes characters in the specified range from this string builder and returns this instance.
*<|endoftext|> |
!it.isCrossinline && !it.type.hasAnnotation(ComposeFqNames.DisallowComposableCalls)
} ?: false
// Locate all inline lambdas in the scope of the given IrElement.
fun scan(element: IrElement) {
element.acceptVoid(object : IrElementVisitorVoid {
override fun visitElement(element: IrElement) { | element.acceptChildrenVoid(this)
}
override fun visitValueParameter(declaration: IrValueParameter) {
declaration.acceptChildrenVoid(this)
val parent = declaration.parent as? IrFunction
if (parent?.isInlineFunctionCall(context) == true &&
declaration.isInlinedFunction()) {<|endoftext|> |
expectSuccess(58) { lastDefaultValueInFunctionInStableClassImpl2(sci2, 100) }
expectFailure(linkage("Function 'removedFirstDefaultValue' can not be called: The call site provides less value arguments (1) than the function requires (2)")) { removedFirstDefaultValueInFunction(1) } | expectSuccess(100) { removedVarargFirstDefaultValueInFunction(100) } // Default IntArray value disappears. So it contrinutes 0 to the sum.
expectFailure(linkage("Function 'removedLastDefaultValue' can not be called: The call site provides less value arguments (1) than the function requires (2)")) { removedLastDefaultValueInFunction(1) }<|endoftext|> |
private val ktIndexExpressions: List<KtExpression>,
private val irIndexExpressions: List<IrExpression>,
private val indexedGetResolvedCall: ResolvedCall<FunctionDescriptor>?,
private val indexedSetResolvedCall: ResolvedCall<FunctionDescriptor>?,
private val indexedGetCall: () -> CallBuilder?,
private val indexedSetCall: () -> CallBuilder?, | private val callGenerator: CallGenerator,
private val startOffset: Int,
private val endOffset: Int,
private val origin: IrStatementOrigin
) : AssignmentReceiver {
private val indexedGetDescriptor = indexedGetResolvedCall?.resultingDescriptor
private val indexedSetDescriptor = indexedSetResolvedCall?.resultingDescriptor<|endoftext|> |
assertEquals("jar", file.extension, "Expected jar file. Found ${file.name}")
}
/* Check if we *really* matched the Android release variant */
(resolvedDependency.gradleArtifact ?: fail("Missing gradleArtifact")).let { artifact ->
if (!artifact.variant.displayName.endsWith("releaseRuntimeElements-published")) | fail("Expected release variant matched. Found ${artifact.variant.displayName}")
}
}
}<|endoftext|> |
resolvedAtom: ResolvedLambdaAtom?, // null is for callable references resolved though the old type inference
descriptor: SimpleFunctionDescriptorImpl,
substitutor: NewTypeSubstitutor
): FunctionLiteralTypes {
val returnType = | (if (resolvedAtom?.isCoercedToUnit == true) builtIns.unitType else resolvedAtom?.returnType) ?: descriptor.returnType
val extensionReceiverType = resolvedAtom?.receiver ?: descriptor.extensionReceiverParameter?.type
val contextReceiversTypes = resolvedAtom?.contextReceivers ?: descriptor.contextReceiverParameters.map { it.type }<|endoftext|> |
// WITH_STDLIB
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// CHECK_STATE_MACHINE
// FILE: inline.kt
import helpers.*
interface SuspendRunnable {
suspend fun run()
}
inline fun inlineMe1(crossinline c: suspend () -> Unit) =
object : SuspendRunnable { | override suspend fun run() {
c()
c()
}
}
inline fun inlineMe2(crossinline c: suspend () -> Unit) = suspend {
c()
c()
}
inline suspend fun inlineMe3(crossinline c: suspend () -> Unit) {
c()
c()
}
inline suspend fun inlineMe4(c: suspend () -> Unit) {<|endoftext|> |
override fun configurePipeline(config: LlvmPipelineConfig, manager: LLVMPassManagerRef, builder: LLVMPassManagerBuilderRef) {
LLVMPassManagerBuilderPopulateModulePassManager(builder, manager)
LLVMPassManagerBuilderPopulateFunctionPassManager(builder, manager)
}
override val pipelineName = "Module LLVM optimizations"
} | class LTOOptimizationPipeline(config: LlvmPipelineConfig, logger: LoggingContext? = null) :
LlvmOptimizationPipeline(config, logger) {
override fun configurePipeline(config: LlvmPipelineConfig, manager: LLVMPassManagerRef, builder: LLVMPassManagerBuilderRef) {
if (config.internalize) {<|endoftext|> |
}
}
class KK : K {
<!INAPPLICABLE_JVM_FIELD!>@JvmField<!>
override val i: Int = 0
<!INAPPLICABLE_JVM_FIELD!>@JvmField<!>
override final val j: Int = 0
}
open class KKK : K { | <!INAPPLICABLE_JVM_FIELD!>@JvmField<!>
override val i: Int = 0
<!INAPPLICABLE_JVM_FIELD!>@JvmField<!>
override final val j: Int = 0
}
class JK(
override val i: Int,<|endoftext|> |
-0x1fee6, 0x2e7101, -0x1fee9, -0x1fef9, 0x79101, -0x0dd1, -0xe7eff, -0x0dfb, -0x0df1, -0x0dd3, -0x0dfb, -0x12beff, 0xc3101, -0x0dfd, | -0x0bfb, -0x0eff, 0x61101, -0x0eff, 0xa3101, 0x82101,<|endoftext|> |
import org.jetbrains.kotlin.analysis.utils.printer.PrettyPrinter
import org.jetbrains.kotlin.renderer.render
public interface KtAnnotationArgumentsRenderer {
public fun renderAnnotationArguments(
analysisSession: KtAnalysisSession,
annotation: KtAnnotationApplication,
owner: KtAnnotated, | annotationRenderer: KtAnnotationRenderer,
printer: PrettyPrinter,
)
public object NONE : KtAnnotationArgumentsRenderer {
override fun renderAnnotationArguments(
analysisSession: KtAnalysisSession,
annotation: KtAnnotationApplication,
owner: KtAnnotated,<|endoftext|> |
private fun notSupportedInInlineCheck(
functionOrProperty: KtCallableDeclaration,
trace: BindingTrace
) {
val visitor = object : KtVisitorVoid() {
override fun visitKtElement(element: KtElement) {
super.visitKtElement(element)
element.acceptChildren(this)
} | override fun visitClass(klass: KtClass) {
trace.report(Errors.NOT_YET_SUPPORTED_IN_INLINE.on(klass, "Local classes"))
}
override fun visitNamedFunction(function: KtNamedFunction) {
if (function.parent.parent is KtObjectDeclaration) {
super.visitNamedFunction(function)<|endoftext|> |
}
}
@Test
fun dropWhile() {
expect(listOf(3.toUByte(), 1.toUByte())) { ubyteArrayOf(2u, 3u, 1u).dropWhile { it < 3u } }
expect(listOf()) { ushortArrayOf().dropWhile { it < 3u } } | expect(listOf()) { uintArrayOf(1u).dropWhile { it < 3u } }
expect(listOf(3uL, 1uL)) { ulongArrayOf(2u, 3u, 1u).dropWhile { it < 3uL } }
}
@Test
fun dropLastWhile() {<|endoftext|> |
// generate call to primary ctor to init serialClassDesc and super()
val primaryCtor = irClass.primaryConstructorOrFail
+IrDelegatingConstructorCallImpl.fromSymbolOwner(
startOffset,
endOffset,
compilerContext.irBuiltIns.unitType,
primaryCtor.symbol
).apply { | irClass.typeParameters.forEachIndexed { index, irTypeParameter ->
putTypeArgument(index, irTypeParameter.defaultType)
}
}
// store type arguments serializers in fields
val thisAsReceiverParameter = irClass.thisReceiver!!
ctor.valueParameters.forEachIndexed { index, param -><|endoftext|> |
public inline fun <V> kotlin.UByteArray.associateWith(valueSelector: (kotlin.UByte) -> V): kotlin.collections.Map<kotlin.UByte, V>
@kotlin.SinceKotlin(version = "1.4")
@kotlin.ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly | public inline fun <V> kotlin.UIntArray.associateWith(valueSelector: (kotlin.UInt) -> V): kotlin.collections.Map<kotlin.UInt, V>
@kotlin.SinceKotlin(version = "1.4")
@kotlin.ExperimentalUnsignedTypes
@kotlin.internal.InlineOnly<|endoftext|> |
private fun findEnclosingSuspendFunction(context: CheckerContext): FirFunction? {
return context.containingDeclarations.lastOrNull {
when (it) {
is FirAnonymousFunction ->
if (it.isLambda) it.typeRef.coneType.isSuspendOrKSuspendFunctionType(context.session) else it.isSuspend
is FirSimpleFunction -> | it.isSuspend
else ->
false
}
} as? FirFunction
}
private fun isInScopeForDefaultParameterValues(enclosingSuspendFunction: FirFunction, context: CheckerContext): Boolean {
val valueParameters = enclosingSuspendFunction.valueParameters
for (declaration in context.containingDeclarations.asReversed()) {
when {<|endoftext|> |
override fun toString() = "$major.$minor.$patch" +
(if (preRelease != null) "-$preRelease" else "") +
(if (build != null) "+$build" else "")
companion object {
fun from(string: String): SemVer {
val minorStart = string.indexOf('.') | check(minorStart != -1) { "Bad semver: $string. Minor version missed." }
val patchStart = string.indexOf('.', minorStart + 1)
check(patchStart != -1) { "Bad semver: $string. Patch version missed." }
val preReleaseStart = string.indexOf('-', patchStart + 1)<|endoftext|> |
val testInfoElementsMap = mutableMapOf<SpecTestInfoElementType, SpecTestInfoElementContent>()
val testInfoElementMatcher = testInfoElementPattern.matcher(rawElements)
while (testInfoElementMatcher.find()) {
val testInfoOriginalElementName = testInfoElementMatcher.group("name") | val testInfoElementValue = parseTestInfoElementValue(testInfoOriginalElementName, testInfoElementMatcher, rawElements)
val testInfoElementName = parseSpecTestInfoElementType(rules, testInfoOriginalElementName)
val testInfoElementValueMatcher = testInfoElementName.valuePattern?.matcher(testInfoElementValue)<|endoftext|> |
name = "MoveOrCopyCompanionObjectFields",
description = "Move and/or copy companion object fields to static fields of companion's owner"
)
internal class MoveOrCopyCompanionObjectFieldsLowering(val context: JvmBackendContext) : ClassLoweringPass {
override fun lower(irClass: IrClass) {
if (irClass.isNonCompanionObject) { | irClass.handle()
} else {
(irClass.declarations.singleOrNull { it is IrClass && it.isCompanion } as IrClass?)?.handle()
}
}
private fun IrClass.handle() {
val newDeclarations = declarations.map {
when (it) {<|endoftext|> |
var minValue = selector(this[0])
for (i in 1..lastIndex) {
val v = selector(this[i])
if (minValue > v) {
minValue = v
}
}
return minValue
}
/**
* Returns the smallest value among all values produced by [selector] function | * applied to each element in the array or `null` if there are no elements.
*/
@SinceKotlin("1.4")
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
@kotlin.internal.InlineOnly<|endoftext|> |
val CHAR_LINEBREAK = 0x80000000.toInt() or 'R'.toInt()
// Quantifier modes.
val QMOD_GREEDY = 0xe0000000.toInt()
val QMOD_RELUCTANT = 0xc0000000.toInt()
val QMOD_POSSESSIVE = 0x80000000.toInt()
// Quantifiers. | val QUANT_STAR = QMOD_GREEDY or '*'.toInt()
val QUANT_STAR_P = QMOD_POSSESSIVE or '*'.toInt()
val QUANT_STAR_R = QMOD_RELUCTANT or '*'.toInt()
val QUANT_PLUS = QMOD_GREEDY or '+'.toInt()<|endoftext|> |
// as close as possible to Java counter loops ('for (int i = a; i < b; ++i) { ... }').
// Otherwise it may result in performance regression due to missing HotSpot optimizations.
// Run Kotlin compiler benchmarks (https://github.com/Kotlin/kotlin-benchmarks)
// with compiler built from your changes if you are not sure.
const val M = Long.MAX_VALUE | fun f(a: Long): Int {
var n = 0
for (i in a..<M) {
n++
}
return n
}
// 0 iterator
// 0 getStart
// 0 getEnd
// 0 getFirst
// 0 getLast
// 0 getStep
// 1 LCMP
// 1 IFGE
// 1 IF
// JVM_IR_TEMPLATES<|endoftext|> |
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsSubTargetDsl
import org.jetbrains.kotlin.gradle.targets.js.npm.npmProject
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest | import org.jetbrains.kotlin.gradle.tasks.dependsOn
import org.jetbrains.kotlin.gradle.tasks.registerTask
import org.jetbrains.kotlin.gradle.testing.internal.configureConventions
import org.jetbrains.kotlin.gradle.testing.internal.kotlinTestRegistry<|endoftext|> |
.firstOrNull { isMain(it) }
?.let { return it }
}
for (subpackageName in module.getSubPackagesOf(packageView.fqName, MemberScope.ALL_NAME_FILTER)) {
getMainFunction(module, module.getPackage(subpackageName))?.let { return it }
}
return null
} | private fun isParameterNumberSuitsForMain(
parametersCount: Int,
isTopLevel: Boolean,
allowParameterless: Boolean
) = when (parametersCount) {
1 -> true
0 -> isTopLevel && allowParameterless && languageVersionSettings.supportsFeature(LanguageFeature.ExtendedMainConvention)
else -> false
}
companion object {<|endoftext|> |
if (!isNotNullLeft(A(0))) return "Fail 3"
if (!isNotNullRight(A(0))) return "Fail 4"
if (isNotNullLeft<Any>(null)) return "Fail 5"
if (isNotNullRight<Any>(null)) return "Fail 6"
if (isNotEqualSame(A(0), A(0))) return "Fail 7" | if (!isNotEqualSame(A(0), A(1))) return "Fail 8"
if (!isNotEqualAnyLeft(A(0), 0)) return "Fail 9"
if (!isNotEqualAnyLeft(A(0), null)) return "Fail 10"
if (isNotEqualAnyLeft(A(0), A(0))) return "Fail 11"<|endoftext|> |
//KT-2851 Type inference failed passing in not-null after smart-cast value in Pair
package a
fun main() {
val value: String? = ""
if (value != null) {
foo(Pair("val", <!DEBUG_INFO_SMARTCAST!>value<!>)) | foo(Pair("val", value<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>))
foo(Pair<String, String>("val", <!DEBUG_INFO_SMARTCAST!>value<!>))
}
}
fun foo(map: Pair<String, String>) {}
//from library
public class Pair<out A, out B> (<|endoftext|> |
codegen.staticData.cStringLiteral(namer.topLevelNamePrefix)
)
emitSelectorsHolder()
emitKt42254Hint()
}
private fun emitTypeAdapters(objCTypeAdapters: List<ObjCTypeAdapter>) {
val placedClassAdapters = mutableMapOf<String, ConstPointer>() | val placedInterfaceAdapters = mutableMapOf<String, ConstPointer>()
objCTypeAdapters.forEach { adapter ->
val typeAdapter = staticData.placeGlobal("", adapter).pointer
val irClass = adapter.irClass
val descriptorToAdapter = if (irClass?.isInterface == true) {
placedInterfaceAdapters
} else {<|endoftext|> |
<!DEBUG_INFO_EXPRESSION_TYPE("{InterfaceWithTypeParameter1<InterfaceWithTypeParameter1<Case5_2>> & InterfaceWithTypeParameter2<InterfaceWithTypeParameter1<Case5_1>>} & {InterfaceWithTypeParameter1<InterfaceWithTypeParameter1<Case5_2>> & InterfaceWithTypeParameter2<InterfaceWithTypeParameter1<Case5_1>>}?")!>x<!> | <!DEBUG_INFO_EXPRESSION_TYPE("{InterfaceWithTypeParameter1<InterfaceWithTypeParameter1<Case5_2>> & InterfaceWithTypeParameter2<InterfaceWithTypeParameter1<Case5_1>>} & {InterfaceWithTypeParameter1<InterfaceWithTypeParameter1<Case5_2>> & InterfaceWithTypeParameter2<InterfaceWithTypeParameter1<Case5_1>><|endoftext|> |
internal fun deserializeIrFunction(proto: ProtoFunction, setParent: Boolean = true): IrSimpleFunction =
withDeserializedIrFunctionBase<IrSimpleFunctionSymbol, IrSimpleFunction>(
proto.base,
setParent,
FUNCTION_SYMBOL
) { symbol, idSig, startOffset, endOffset, origin, fcode -> | val flags = FunctionFlags.decode(fcode)
symbolTable.declareSimpleFunction(idSig, { symbol }) {
val nameType = BinaryNameAndType.decode(proto.base.nameType)
irFactory.createSimpleFunction(
startOffset = startOffset,
endOffset = endOffset,
origin = origin,<|endoftext|> |
// This file was generated automatically. See compiler/fir/tree/tree-generator/Readme.md.
// DO NOT MODIFY IT MANUALLY.
@file:Suppress("DuplicatedCode", "unused")
package org.jetbrains.kotlin.fir.declarations.builder
import kotlin.contracts.* | import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.fir.FirModuleData
import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl<|endoftext|> |
generateInstanceFieldAccess(field, location)
}
wasmSymbols.unsafeGetScratchRawMemory -> {
body.buildConstI32Symbol(context.scratchMemAddr, location)
}
wasmSymbols.returnArgumentIfItIsKotlinAny -> {
body.buildBlock("returnIfAny", WasmAnyRef) { innerLabel -> | body.buildGetLocal(functionContext.referenceLocal(0), location)
body.buildInstr(WasmOp.EXTERN_INTERNALIZE, location)
body.buildBrOnCastInstr(
WasmOp.BR_ON_CAST_FAIL,
innerLabel,
fromIsNullable = true,
toIsNullable = true,<|endoftext|> |
override val KotlinTypeMarker.fqNameUnsafe: FqNameUnsafe?
get() = ((this as? ConeLookupTagBasedType)?.lookupTag as? ConeClassLikeLookupTag)?.classId?.asSingleFqName()?.toUnsafe()
override val KotlinTypeMarker.enhancedForWarnings: KotlinTypeMarker? | get() = (this as ConeKotlinType).enhancedTypeForWarning
override fun KotlinTypeMarker.isEqual(other: KotlinTypeMarker): Boolean =
AbstractTypeChecker.equalTypes(session.typeContext, this, other)<|endoftext|> |
// FIR_IDENTICAL
// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
inline class IC(val i: Int)
<!CONFLICTING_JVM_DECLARATIONS!>fun foo(a: Any, ic: IC) {}<!> | <!CONFLICTING_JVM_DECLARATIONS!>fun foo(a: Any?, ic: IC) {}<!><|endoftext|> |
metadata = FirMetadataSource.Function(function)
declarationStorage.withScope(symbol) {
/*
* `isLocal = true` indicates that a function is local or member of a local class
* containingClassLookupTag allows to distinguish those two cases
*/
setParent(irParent)
if (!(isLocal && function.containingClassLookupTag() == null)) { | addDeclarationToParent(this, irParent)
}
declareParameters(
function, irParent,
dispatchReceiverType = computeDispatchReceiverType(this, simpleFunction, irParent, c),
isStatic = simpleFunction?.isStatic == true,
forSetter = false,
)
convertAnnotationsForNonDeclaredMembers(function, origin)
}
}<|endoftext|> |
this.v = v;
}
public String get() {
return v;
}
}
// FILE: test.kt
annotation class ValueContainer
data class JavaStringProperty(private var v: String): JavaProperty<String> {
override fun assign(v: String) {
this.v = v
}
override fun get() = this.v
} | @ValueContainer
interface KotlinProperty<T> {
fun assign(argument: T);
fun get(): T;
}
data class KotlinStringProperty(private var v: String): KotlinProperty<String> {
override fun assign(v: String) {
this.v = v
}
override fun get() = this.v
}<|endoftext|> |
import org.jetbrains.kotlin.ir.declarations.IrFunction
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.util.DeepCopySymbolRemapper
import org.jetbrains.kotlin.ir.util.isEnumClass
import org.jetbrains.kotlin.ir.util.isLocal | import org.jetbrains.kotlin.ir.util.parentAsClass
abstract class AbstractDecoysLowering(
pluginContext: IrPluginContext,
symbolRemapper: DeepCopySymbolRemapper,
metrics: ModuleMetrics,
stabilityInferencer: StabilityInferencer,
override val signatureBuilder: IdSignatureFactory
) : AbstractComposeLowering(<|endoftext|> |
fun <@TypeParameterAnn("TP1") @TypeParameterAnnBinary @TypeParameterAnnSource T, @TypeParameterAnn("TP2") @TypeParameterAnnBinary @TypeParameterAnnSource T2> typeParameter() {
} | fun <@TypeParameterAnn("TP") T> genericParameterAndReturn(s: @TypeAnn("1") @TypeAnnBinary @TypeAnnSource T): @TypeAnn("2") @TypeAnnBinary @TypeAnnSource T {
return s
}<|endoftext|> |
private const val MODULES_LIST = "MODULES"
private const val MODULES_KIND = "MODULE_KIND"
private const val LIBS_LIST = "libs"
private const val DIRTY_JS_FILES_LIST = "dirty js files"
private const val DIRTY_JS_MODULES_LIST = "dirty js modules"
private const val LANGUAGE = "language" | private const val IGNORE_PER_FILE = "IGNORE_PER_FILE"
private const val IGNORE_PER_MODULE = "IGNORE_PER_MODULE"
const val MODULE_INFO_FILE = "module.info"
private const val DEPENDENCIES = "dependencies"
private const val FRIENDS = "friends"
private const val MODIFICATIONS = "modifications"<|endoftext|> |
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface Foo<T> {
fun foo(l: List<T>)
}
interface Bar<T> {
fun foo(l: List<T>)
}
<!CONFLICTING_JVM_DECLARATIONS!>class Baz(f: Foo<String>, b: Bar<Int>) : | Foo<String> by f,
Bar<Int> by b {
}<!><|endoftext|> |
$this$filterTo\29:java.lang.Iterable=java.util.ArrayList, destination\29:java.util.Collection=java.util.ArrayList, $i$f$filterTo\29\464:int=0:int, element\29:java.lang.Object=java.lang.Integer, it\30:int=4:int, | $i$a$-filter-LibraryKt$foo$7\30\465\1:int=0:int<|endoftext|> |
@Suppress("UNCHECKED_CAST")
public inline var <P : CPointer<*>> CPointerVarOf<P>.value: P?
get() = interpretCPointer<CPointed>(nativeMemUtils.getNativePtr(this)) as P?
set(value) = nativeMemUtils.putNativePtr(this, value.rawValue)
/** | * The code or data pointed by the value of this variable.
*
* @param T must not be abstract
*/
@ExperimentalForeignApi
public inline var <reified T : CPointed, reified P : CPointer<T>> CPointerVarOf<P>.pointed: T?
get() = this.value?.pointed
set(value) {<|endoftext|> |
// !DIAGNOSTICS: -UNUSED_VARIABLE
// SKIP_TXT
sealed class A
sealed class B : A()
sealed class C : A()
object BB : B()
object CC : C()
fun foo(a: A) {
if (a is B) {
if (a is C) {
val t = when (a) { | <!USELESS_IS_CHECK!>is CC<!> -> "CC"
}
}
}
}
fun foo2(a: A) {
if (a is C) {
if (a is B) {
val t = when (a) {
<!USELESS_IS_CHECK!>is CC<!> -> "CC"
}
}<|endoftext|> |
if (kind != ItemKind.Invalid) {
if (this.kind != kind) {
schemeParseError()
}
when (this.kind) {
ItemKind.Open -> expect('[')
ItemKind.Close -> expect(']')
ItemKind.ResultPrefix -> expect(':')
ItemKind.AnyParameters -> expect('*')
ItemKind.Token -> token() | ItemKind.Number -> number()
ItemKind.End -> end()
else -> schemeParseError()
}
}
}
private val ch: Char get() = if (current < value.length) value[current] else eos
private fun expect(ch: Char) {
if (current < value.length && value[current] == ch) {
current++<|endoftext|> |
// !LANGUAGE: -SamConversionForKotlinFunctions
// FILE: Runnable.java
public interface Runnable {
void run();
}
// FILE: 1.kt
interface K {
fun foo1(r: Runnable)
fun foo2(r1: Runnable, r2: Runnable) | fun foo3(r1: Runnable, r2: Runnable, r3: Runnable)
}
fun test(k: K, r: Runnable) {
k.foo1(r)
k.foo1({})
k.foo2(r, r)
k.foo2({}, {})
k.foo2(r, {})<|endoftext|> |
symbols--
}
}
return ((symbols.toLong() * bitsPerSymbol) / bitsPerByte).toInt() // conversion due to possible Int overflow
}
internal fun charsToBytesImpl(source: CharSequence, startIndex: Int, endIndex: Int): ByteArray {
checkSourceBounds(source.length, startIndex, endIndex) | val byteArray = ByteArray(endIndex - startIndex)
var length = 0
for (index in startIndex until endIndex) {
val symbol = source[index].code
if (symbol <= 0xFF) {
byteArray[length++] = symbol.toByte()
} else {
// the replacement byte must be an illegal symbol<|endoftext|> |
project.evaluate()
}
@Test
@Suppress("deprecation")
fun `test - default configuration - AndroidSourceSet has KotlinSourceSet as convention`() {
android.sourceSets.all { androidSourceSet ->
assertSame(
project.getKotlinSourceSetOrFail(androidSourceSet), | (androidSourceSet as org.gradle.api.internal.HasConvention).convention.plugins["kotlin"] as? KotlinSourceSet,
"Expected Convention 'kotlin' on AndroidSourceSet: ${androidSourceSet.name}"
)
}
project.evaluate()
}
@Test<|endoftext|> |
override val name: CirName,
val returnType: CirType,
val varargElementType: CirType?,
val declaresDefaultValue: Boolean,
val isCrossinline: Boolean,
val isNoinline: Boolean
) : CirHasAnnotations, CirHasName {
// See also org.jetbrains.kotlin.types.KotlinType.cachedHashCode | private var cachedHashCode = 0
private fun computeHashCode() = hashCode(name)
.appendHashCode(annotations)
.appendHashCode(returnType)
.appendHashCode(varargElementType)
.appendHashCode(declaresDefaultValue)
.appendHashCode(isCrossinline)
.appendHashCode(isNoinline)<|endoftext|> |
val innerDeclaration = this.kotlinOrigin
?.declarations
?.filterIsInstance<KtClassOrObject>()
?.firstOrNull { cls -> cls.name == this.clsDelegate.name }
KtLightClassForDecompiledDeclaration(
clsDelegate = psiClass,
clsParent = this,
file = file, | kotlinOrigin = innerDeclaration,
)
}
}
override val originKind: LightClassOriginKind = LightClassOriginKind.BINARY
override fun getNavigationElement() = kotlinOrigin?.navigationElement ?: file
override fun equals(other: Any?): Boolean {
return this === other || other is KtLightClassForDecompiledDeclaration &&<|endoftext|> |
// test.kt:7 start: this_\1:Foo=Foo, $i$f$inlineCall\1\13:int=0:int | // test.kt:14 start: this_\1:Foo=Foo, $i$f$inlineCall\1\13:int=0:int, it\2:kotlin.jvm.functions.Function0=Foo$inlineCall$1, $i$a$-inlineCall-Foo$start$1\2\84\0:int=0:int<|endoftext|> |
override var defaultValueInBuilder: String? = null
override var isMutable: Boolean = origin.isMutable
override val isMutableOrEmptyList: Boolean
get() = origin.isMutableOrEmptyList
override var isMutableInInterface: Boolean = origin.isMutableInInterface
override var customSetter: String? = null | override var fromDelegate: Boolean = false
override val overriddenTypes: MutableSet<TypeRefWithNullability>
get() = origin.overriddenTypes
override val arbitraryImportables: MutableList<Importable>
get() = origin.arbitraryImportables
override var useNullableForReplace: Boolean
get() = origin.useNullableForReplace<|endoftext|> |
val l = { hit = true; false }
call(false) {
assert(l()) { "BOOYA" }
}
return hit
}
}
fun setDesiredAssertionStatus(v: Boolean): Checker {
val loader = Checker::class.java.classLoader
loader.setDefaultAssertionStatus(false) | val className = if (v) "ShouldBeEnabled" else "ShouldBeDisabled"
loader.setClassAssertionStatus(className, v)
val c = loader.loadClass(className)
return c.newInstance() as Checker
}
fun box(): String {
var c = setDesiredAssertionStatus(false)<|endoftext|> |
// FILE: GoBuildingRunningState.java
public abstract class GoBuildingRunningState<T extends GoBuildingRunConfiguration<? extends GoBuildingRunningState<T>>> implements RunProfileState {
public String getBuildingWorkingDirectory() {
return "";
}
}
// FILE: GoBuildingRunConfiguration.java
public abstract class GoBuildingRunConfiguration<RunningState extends GoBuildingRunningState<? extends GoBuildingRunConfiguration<RunningState>>> { } | // FILE: RunProfileState.java
public interface RunProfileState {
}
// FILE: Test.java
import org.jetbrains.annotations.Nullable;
public class Test {
@Nullable
public RunProfileState getState() {
return null;
}
}
// FILE: main.kt
fun String.asFsdAddress(): String {
return ""
}<|endoftext|> |