prompt
stringlengths
1
924
completion
stringlengths
14
937
commandCount++ if (commandCount >= environment.configuration.maxCommands) InterpreterTimeOutError().handleUserException(environment) } private fun getUnitState(): State = environment.mapOfObjects[irBuiltIns.unitClass]!! private fun Instruction.handle() { when (this) { is CompoundInstruction -> unfoldInstruction(this.element, environment)
is SimpleInstruction -> interpret(this.element).also { incrementAndCheckCommands() } is CustomInstruction -> this.evaluate() } } fun interpret(expression: IrExpression, file: IrFile? = null): IrExpression { commandCount = 0 callStack.newFrame(expression, file) callStack.pushCompoundInstruction(expression)<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>k<!> <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?"), DEBUG_INFO_SMARTCAST!>k<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>v<!> <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?"), DEBUG_INFO_SMARTCAST!>v<!>.inv() } } // TESTCASE NUMBER: 16<|endoftext|>
(this as FakeDirectory) val components: MutableList<String> = path.map { it.fileName?.toString().orEmpty() }.reversed().toMutableList() var current = contents var value: FakeFileSystem? = null while (components.isNotEmpty()) { value = current[components.popLast()] when (value) {
is FakeDirectory -> current = value.contents is FakeFile -> if (components.isNotEmpty()) return null null -> return null } } return value } fun subdirectoryAt(path: Path): FakeDirectory { when (val directory = fileSystemAt(path)) { is FakeDirectory -> return directory is FakeFile -> error("Path $path is a file")<|endoftext|>
""" public class A { @Annotation1 protected String value; } @interface Annotation1 {} """.trimIndent() ) val secondHash = getHash( """ public class A { @Annotation2 protected String value; } @interface Annotation2 {} """.trimIndent() )
assertArrayNotEquals(firstHash, secondHash) } @Test fun testConstants() { val firstHash = getHash( """ public class A { static final String VALUE = "value_1"; } """.trimIndent() ) val secondHash = getHash( """ public class A {<|endoftext|>
private val uLongClassId = ClassId.fromString("kotlin/ULong") @InternalKotlinNativeApi enum class NSNumberKind(val mappedKotlinClassId: ClassId?, val objCType: ObjCType) { CHAR(PrimitiveType.BYTE, ObjCPrimitiveType.char),
UNSIGNED_CHAR(uByteClassId, ObjCPrimitiveType.unsigned_char), SHORT(PrimitiveType.SHORT, ObjCPrimitiveType.short), UNSIGNED_SHORT(uShortClassId, ObjCPrimitiveType.unsigned_short), INT(PrimitiveType.INT, ObjCPrimitiveType.int),<|endoftext|>
} else { Other } } private fun getArrayFunctionCallName(expectedType: KotlinType): Name { if (TypeUtils.noExpectedType(expectedType) || !(KotlinBuiltIns.isPrimitiveArray(expectedType) || KotlinBuiltIns.isUnsignedArrayType(expectedType)) ) {
return ArrayFqNames.ARRAY_OF_FUNCTION } val descriptor = expectedType.constructor.declarationDescriptor ?: return ArrayFqNames.ARRAY_OF_FUNCTION return ArrayFqNames.PRIMITIVE_TYPE_TO_ARRAY[KotlinBuiltIns.getPrimitiveArrayType(descriptor)]<|endoftext|>
configurationTimeMetrics: MetricContainer, ) { for (plugin in ObservablePlugins.values()) { project.plugins.withId(plugin.title) { configurationTimeMetrics.put(plugin.metric, true) } } } private fun reportLibrariesVersions( configurationTimeMetrics: MetricContainer, dependencies: DependencySet?,
) { dependencies?.filter { it !is ProjectDependency }?.forEach { dependency -> when { dependency.group?.startsWith("org.springframework") ?: false -> configurationTimeMetrics.put( StringMetrics.LIBRARY_SPRING_VERSION, dependency.version ?: "0.0.0" )<|endoftext|>
assertFailsWith<IllegalArgumentException> { HexFormat { bytes.bytePrefix = "\n" } } assertFailsWith<IllegalArgumentException> { HexFormat { bytes.bytePrefix = "\r" } } } @Test fun byteSuffixWithNewLine() {
assertFailsWith<IllegalArgumentException> { HexFormat { bytes.byteSuffix = "ab\n\rcd" } } assertFailsWith<IllegalArgumentException> { HexFormat { bytes.byteSuffix = "ab\r\ncd" } } } // format.toString() @Test fun formatToString() {<|endoftext|>
if (this.d != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>d<!>.equals(null)
if (this.d != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>d<!>.propT<|endoftext|>
* @param delimiters One or more strings to be used as delimiters. * @param ignoreCase `true` to ignore character case when matching a delimiter. By default `false`. * @param limit The maximum number of substrings to return. Zero by default means no limit is set. * * To avoid ambiguous results when strings in [delimiters] have characters in common, this method proceeds from
* the beginning to the end of this string, and matches at each position the first element in [delimiters] * that is equal to a delimiter in this instance at that position. */ public fun CharSequence.split(vararg delimiters: String, ignoreCase: Boolean = false, limit: Int = 0): List<String> { if (delimiters.size == 1) {<|endoftext|>
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 3 -> sentence 1 * NUMBER: 6 * DESCRIPTION: Non-extension member callables for delegated properties call */ // FILE: LibMyIterator.kt package libMyIteratorPackage var isGetCalled = false var isSetCalled = false // FILE: Lib1.kt
package libPackage1 import libMyIteratorPackage.* import testPack.Delegate import kotlin.reflect.KProperty operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String { return "" } operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {} // FILE: Lib2.kt package libPackage2<|endoftext|>
* @sample samples.collections.Collections.Filtering.filterTo */ public inline fun <T, C : MutableCollection<in T>> Iterable<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]. * * @sample samples.collections.Collections.Filtering.filterTo */ public inline fun <T, C : MutableCollection<in T>> Iterable<T>.filterTo(destination: C, predicate: (T) -> Boolean): C {<|endoftext|>
if (!c.checkTrue()) return "FAIL 4" if (!c.checkTrueWithMessage()) return "FAIL 5" try { c.checkFalse() return "FAIL 6" } catch (ignore: AssertionError) { } try { c.checkFalseWithMessage() return "FAIL 7"
} catch (ignore: AssertionError) { } return "OK" }<|endoftext|>
LAZY_PROPERTY("lazy property") { override fun isAvailable(descriptor: ExtractableCodeDescriptor): Boolean { // Should not report UNINITIALIZED_ENUM_COMPANION return checkNotTrait(descriptor) } }; abstract fun isAvailable(descriptor: ExtractableCodeDescriptor): Boolean
companion object { fun checkNotTrait(descriptor: ExtractableCodeDescriptor): Boolean { return !descriptor.isInterface() } } }<|endoftext|>
fun titlecaseChar() { // titlecaseChar == char && uppercaseChar != char assertEquals('\u10CF'.uppercaseChar(), '\u10CF'.titlecaseChar()) for (char in '\u10D0'..'\u10FA') { assertEquals(char, char.titlecaseChar()) assertNotEquals(char, char.uppercaseChar())
} for (char in '\u10FB'..'\u10FC') { assertEquals(char, char.titlecaseChar()) assertEquals(char, char.uppercaseChar()) } for (char in '\u10FD'..'\u10FF') { assertEquals(char, char.titlecaseChar())<|endoftext|>
package org.jetbrains.kotlin.ir.backend.js.transformers.irToJs import org.jetbrains.kotlin.ir.backend.js.utils.emptyScope import org.jetbrains.kotlin.js.backend.ast.* object JsTestFunctionTransformer {
fun generateTestFunctionCall(testFunctionContainers: List<TestFunctionContainer>): JsInvocation? { if (testFunctionContainers.isEmpty()) return null val testFunBody = JsBlock() val testFun = JsFunction(emptyScope, testFunBody, "root test fun")<|endoftext|>
override val keys: Set<K> get() = throw UnsupportedOperationException() override val values: Collection<V> get() = throw UnsupportedOperationException() override val entries: Set<Map.Entry<K, V>> get() = throw UnsupportedOperationException() public fun put(key: K, value: V): V? = null public fun remove(key: K): V? = null
public fun putAll(m: Map<out K, V>) {} public fun clear() {} } fun box(): String { val myMap = MyMap<String, Int>() val map = myMap as java.util.Map<String, Int> map.put("", 1) map.remove("") map.putAll(myMap) map.clear()<|endoftext|>
@ExperimentalUnsignedTypes @kotlin.internal.InlineOnly public inline fun ULongArray.sumOf(selector: (ULong) -> Int): Int { var sum: Int = 0.toInt() for (element in this) { sum += selector(element) } return sum } /**
* Returns the sum of all values produced by [selector] function applied to each element in the array. */ @SinceKotlin("1.4") @OptIn(kotlin.experimental.ExperimentalTypeInference::class) @OverloadResolutionByLambdaReturnType @Suppress("INAPPLICABLE_JVM_NAME") @kotlin.jvm.JvmName("sumOfInt")<|endoftext|>
package test.utils import kotlin.test.* class TODOTest { private class PartiallyImplementedClass { public val prop: String get() = TODO() @Suppress("UNREACHABLE_CODE", "CAST_NEVER_SUCCEEDS") fun method1() = TODO() as String public fun method2(): Int = TODO()
public fun method3(switch: Boolean, value: String): String { if (!switch) TODO("what if false") else { if (value.length < 3) @Suppress("UNREACHABLE_CODE") throw TODO("write message") } return value } public fun method4() { TODO() }<|endoftext|>
facet.useProjectSettings = false facet.compilerArguments = K2JVMCompilerArguments() (facet.compilerArguments as K2JVMCompilerArguments).useK2 = false it.container.setChild( JpsKotlinFacetModuleExtension.KIND, JpsKotlinFacetModuleExtension(facet) )
} buildAllModules().assertSuccessful() myProject.modules.forEach { val facet = KotlinFacetSettings() facet.useProjectSettings = false facet.compilerArguments = K2JVMCompilerArguments() (facet.compilerArguments as K2JVMCompilerArguments).useK2 = true it.container.setChild(<|endoftext|>
d.returnType?.constructor?.declarationDescriptor?.let { symbolTable.referenceClassifier(it) } } else null } override val extensionToString: IrSimpleFunctionSymbol = findFunctions(OperatorNameConventions.TO_STRING, "kotlin").first { val descriptor = it.descriptor
descriptor is SimpleFunctionDescriptor && descriptor.dispatchReceiverParameter == null && descriptor.extensionReceiverParameter != null && KotlinBuiltIns.isNullableAny(descriptor.extensionReceiverParameter!!.type) && descriptor.valueParameters.isEmpty() } override val memberToString: IrSimpleFunctionSymbol = findBuiltInClassMemberFunctions(<|endoftext|>
public inline operator fun rem(other: ULong): ULong = this.toULong().rem(other) /** * Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. * * For unsigned types, the results of flooring division and truncating division are the same. */ @kotlin.internal.InlineOnly
public inline fun floorDiv(other: UByte): UInt = this.toUInt().floorDiv(other.toUInt()) /** * Divides this value by the other value, flooring the result to an integer that is closer to negative infinity. * * For unsigned types, the results of flooring division and truncating division are the same. */ @kotlin.internal.InlineOnly<|endoftext|>
// Both [directEdges] and [reversedEdges] are the array representation of a graph: // for each node v the edges of that node are stored in edges[edges[v] until edges[v + 1]]. private data class ConstraintGraphBuildResult(val instantiatingClasses: BitSet, val directEdges: IntArray, val reversedEdges: IntArray)
// Here we're dividing the build process onto two phases: // 1. build bag of edges and direct edges array; // 2. build reversed edges array from the direct edges array. // This is to lower memory usage (all of these edges structures are more or less equal by size), // and by that we're only holding references to two out of three of them.<|endoftext|>
class Test() : IBar { override suspend fun bar(): IC = IC("OK") suspend fun test1(): String { val b: IBar = this return (b.bar() as IC).s as String } suspend fun test2(): String = bar().s as String } fun box(): String { var result = "FAIL 1" builder {
result = Test().test1() } if (result != "OK") return "FAIL 1 $result" result = "FAIL2 " builder { result = Test().test2() } if (result != "OK") return "FAIL 2 $result" return result }<|endoftext|>
fun takeWithReference(a: WithReference) {} OPTIONAL_JVM_INLINE_ANNOTATION value class WithNullableReference(val a: Any?) fun takeWithNullableReference(a: WithNullableReference) {} fun foo(a: WithPrimitive?, b: WithPrimitive) { takeWithPrimitive(a!!) // unbox takeWithPrimitive(a) // unbox
takeWithPrimitive(b!!) } fun bar(a: WithReference?, b: WithReference) { takeWithReference(a!!) takeWithReference(a) takeWithReference(b!!) } fun baz(a: WithNullableReference?, b: WithNullableReference) { takeWithNullableReference(a!!) // unbox<|endoftext|>
result.add(AnnotationWithArgs(annotationClassId, args)) } } } } protected fun isRepeatableWithImplicitContainer(annotationClassId: ClassId, arguments: Map<Name, ConstantValue<*>>): Boolean { if (annotationClassId != SpecialJvmAnnotations.JAVA_LANG_ANNOTATION_REPEATABLE) return false
val containerKClassValue = arguments[JvmAnnotationNames.DEFAULT_ANNOTATION_MEMBER_NAME] as? KClassValue ?: return false return isImplicitRepeatableContainer((containerKClassValue.value as KClassValue.Value.NormalClass).classId) }<|endoftext|>
project("appleXCFramework", gradleVersion) { projectPath.resolve("shared/src").deleteRecursively() build(":shared:assembleXCFramework") { assertTasksNoSource( ":shared:assembleSharedDebugXCFramework", ":shared:assembleSharedReleaseXCFramework", ) } } }
@DisplayName("XCFramework handles dashes in its name correctly") @GradleTest fun shouldCheckDashesHandlingWithXCFramework(gradleVersion: GradleVersion) { project("appleXCFramework", gradleVersion) { val sharedBuildGradleKts = subProject("shared").buildGradleKts<|endoftext|>
override fun toString(): String { return value.toString() } companion object { private val companionObjectValue = mapOf<String, Any>("kotlin.text.Regex\$Companion" to Regex.Companion) // TODO remove later; used for tests only private val intrinsicClasses = setOf(
"kotlin.text.StringBuilder", "kotlin.Pair", "kotlin.collections.ArrayList", "kotlin.collections.HashMap", "kotlin.collections.LinkedHashMap", "kotlin.collections.HashSet", "kotlin.collections.LinkedHashSet",<|endoftext|>
fun consume(arg: UserEnumeration) {} val buildee = build { consume(materialize()) } checkExactType<Buildee<UserEnumeration>>(buildee) } fun testThisExpression() { fun <T> shareTypeInfo(from: T, to: T) {} val buildee = build {
shareTypeInfo(this@UserEnumeration, materialize()) } checkExactType<Buildee<UserEnumeration>>(buildee) } testBasicCase() testThisExpression() } } fun box(): String { with(UserEnumeration.ENUM_ENTRY) { testYield() testMaterialize() }<|endoftext|>
@kotlin.OverloadResolutionByLambdaReturnType @kotlin.jvm.JvmName(name = "sumOfInt") @kotlin.internal.InlineOnly public inline fun <T> kotlin.Array<out T>.sumOf(selector: (T) -> kotlin.Int): kotlin.Int
@kotlin.SinceKotlin(version = "1.4") @kotlin.OverloadResolutionByLambdaReturnType @kotlin.jvm.JvmName(name = "sumOfLong") @kotlin.internal.InlineOnly<|endoftext|>
// WITH_STDLIB import kotlin.test.assertEquals fun box() : String { val result1 = (1..100).count { x -> x % 2 == 0 } val result2 = (1..100).filter { x -> x % 2 == 0 }.size assertEquals(result1, 50) assertEquals(result2, 50)
val result3 = (1..100).map { x -> 2 * x }.count { x -> x % 2 == 0 } val result4 = (1..100).map { x -> 2 * x }.filter { x -> x % 2 == 0 }.size assertEquals(result3, 100) assertEquals(result4, 100)<|endoftext|>
public inline fun <V> kotlin.ULongArray.zip(other: kotlin.ULongArray, transform: (a: kotlin.ULong, b: kotlin.ULong) -> V): kotlin.collections.List<V> @kotlin.SinceKotlin(version = "1.3") @kotlin.ExperimentalUnsignedTypes
public infix fun <R> kotlin.ULongArray.zip(other: kotlin.collections.Iterable<R>): kotlin.collections.List<kotlin.Pair<kotlin.ULong, R>> @kotlin.SinceKotlin(version = "1.3") @kotlin.ExperimentalUnsignedTypes @kotlin.internal.InlineOnly<|endoftext|>
this.stringValue = strings.getStringIndex(value) } is KmAnnotationArgument.KClassValue -> { this.type = ProtoBuf.Annotation.Argument.Value.Type.CLASS this.classId = strings.getClassNameIndex(className) } is KmAnnotationArgument.ArrayKClassValue -> {
this.type = ProtoBuf.Annotation.Argument.Value.Type.CLASS this.classId = strings.getClassNameIndex(className) this.arrayDimensionCount = this@writeAnnotationArgument.arrayDimensionCount } is KmAnnotationArgument.EnumValue -> { this.type = ProtoBuf.Annotation.Argument.Value.Type.ENUM<|endoftext|>
import org.jetbrains.kotlin.parcelize.ParcelizeNames.RAW_VALUE_ANNOTATION_FQ_NAMES class IrParcelSerializerFactory(private val symbols: AndroidSymbols, private val parcelizeAnnotations: List<FqName>) { private val supportedBySimpleListSerializer = setOf(
"kotlin.collections.List", "kotlin.collections.MutableList", "kotlin.collections.ArrayList", "java.util.List", "java.util.ArrayList", *BuiltinParcelableTypes.IMMUTABLE_LIST_FQNAMES.toTypedArray() ) // TODO: More java collections?<|endoftext|>
private inline fun convertModifiers( containingClass: ClassNode, access: Int, kind: ElementKind, packageFqName: String, visibleAnnotations: List<AnnotationNode>?, invisibleAnnotations: List<AnnotationNode>?, descriptorAnnotations: Annotations ): JCModifiers = convertModifiers( containingClass, access.toLong(),
kind, packageFqName, visibleAnnotations, invisibleAnnotations, descriptorAnnotations ) private fun convertModifiers( containingClass: ClassNode, access: Long, kind: ElementKind, packageFqName: String, visibleAnnotations: List<AnnotationNode>?, invisibleAnnotations: List<AnnotationNode>?,<|endoftext|>
// LANGUAGE: +MultiPlatformProjects // MODULE: common // FILE: common.kt expect class A { val x: Int } expect abstract class B expect class C : B expect abstract class D() { <!AMBIGUOUS_ACTUALS{JVM}!>val x: Int<!> } class E : D()
// MODULE: jvm()()(common) // FILE: main.kt interface I { val x: Int } actual class A : I { actual val <!VIRTUAL_MEMBER_HIDDEN!>x<!> = 0 } actual abstract class B() { val x = 0 } actual class C : B(), I {} actual abstract class D {<|endoftext|>
project.plugins.apply(ComposeCompilerGradleSubplugin::class.java) } fun Project.applyMultiplatformPlugin(): KotlinMultiplatformExtension { addBuildEventsListenerRegistryMock(this) disableLegacyWarning(project) plugins.apply("kotlin-multiplatform") return extensions.getByName("kotlin") as KotlinMultiplatformExtension }
internal fun disableLegacyWarning(project: Project) { project.extraProperties.set("kotlin.js.compiler.nowarn", "true") }<|endoftext|>
public inline fun kotlin.LongArray.reduceOrNull(operation: (acc: kotlin.Long, kotlin.Long) -> kotlin.Long): kotlin.Long? @kotlin.SinceKotlin(version = "1.4")
public inline fun kotlin.ShortArray.reduceOrNull(operation: (acc: kotlin.Short, kotlin.Short) -> kotlin.Short): kotlin.Short? @kotlin.SinceKotlin(version = "1.4") @kotlin.ExperimentalUnsignedTypes @kotlin.internal.InlineOnly<|endoftext|>
// FIR_IDENTICAL // !LANGUAGE: +AbstractClassMemberNotImplementedWithIntermediateAbstractClass interface A { fun foo(): Any } interface B { fun foo(): String = "A" } open class D: B open <!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class C<!>: D(), A // ------------
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class Test<!>: Impl(), CProvider open class CC class DD: CC() interface CProvider { fun getC(): CC } interface DProvider { fun getC(): DD = DD() } open class Impl: DProvider<|endoftext|>
val answer = SmartList<PsiClass>() val qualifiedName = FqName(qualifiedNameString) findClassesAndObjects(qualifiedName, scope, answer) answer.addAll(kotlinAsJavaSupport.getFacadeClasses(qualifiedName, scope)) answer.addAll(kotlinAsJavaSupport.getKotlinInternalClasses(qualifiedName, scope))
sortByPreferenceToSourceFile(answer, scope) return answer.toTypedArray() } // Finds explicitly declared classes and objects, not package classes // Also DefaultImpls classes of interfaces, Container classes of repeatable annotations private fun findClassesAndObjects(qualifiedName: FqName, scope: GlobalSearchScope, answer: MutableList<PsiClass>) {<|endoftext|>
* Returns the absolute value of this value. * * Special cases: * - `Long.MIN_VALUE.absoluteValue` is `Long.MIN_VALUE` due to an overflow * * @see abs function */ @SinceKotlin("1.2") @InlineOnly public actual inline val Long.absoluteValue: Long get() = abs(this) /** * Returns the sign of this value:
* - `-1` if the value is negative, * - `0` if the value is zero, * - `1` if the value is positive */ @SinceKotlin("1.2") public actual val Long.sign: Int get() = when { this < 0 -> -1 this > 0 -> 1 else -> 0 } // endregion<|endoftext|>
<!CONFLICTING_OVERLOADS!>fun testMultipleDifferentlyNamedValueParametersB(arg1B: UserKlassA, arg2B: UserKlassB)<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun testMultipleTypeAliasedValueParameterTypesA(arg1: UserKlassA, arg2: UserKlassB)<!> {}<|endoftext|>
override val origin: FirFunctionCallOrigin = FirFunctionCallOrigin.Operator override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) { annotations.forEach { it.accept(visitor, data) } contextReceiverArguments.forEach { it.accept(visitor, data) }
typeArguments.forEach { it.accept(visitor, data) } argumentList.accept(visitor, data) calleeReference.accept(visitor, data) explicitReceiver.accept(visitor, data) if (dispatchReceiver !== explicitReceiver) { dispatchReceiver?.accept(visitor, data) }<|endoftext|>
expectOrder("0 in (low(1) until Int.MIN_VALUE).reversed()", "L") { assertFalse(0 in (low(1) until Int.MIN_VALUE).reversed()) } expectOrder("0 in (low(1) until minValue()).reversed()", "L") { assertFalse(0 in (low(1) until minValue()).reversed()) }
expectOrder("x(0) in (1 until Int.MIN_VALUE).reversed()", "X") { assertFalse(x(0) in (1 until Int.MIN_VALUE).reversed()) } expectOrder("x(0) in (1 until minValue()).reversed()", "X") { assertFalse(x(0) in (1 until minValue()).reversed()) }<|endoftext|>
public inline fun <T : Any, R> assertNotNull(actual: T?, message: String? = null, block: (T) -> R) { contract { returns() implies (actual != null) } block(assertNotNull(actual, message)) } /** Asserts that the [actual] value is `null`, with an optional [message]. */
public fun assertNull(actual: Any?, message: String? = null) { asserter.assertNull(message, actual) } /** Asserts that the [iterable] contains the specified [element], with an optional [message]. */ @SinceKotlin("1.5")<|endoftext|>
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.SpecialNames import org.jetbrains.kotlin.platform.jvm.isJvm import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.util.OperatorNameConventions
import org.jetbrains.kotlin.utils.DFS abstract class AbstractComposeLowering( val context: IrPluginContext, val symbolRemapper: DeepCopySymbolRemapper, val metrics: ModuleMetrics, val stabilityInferencer: StabilityInferencer ) : IrElementTransformerVoid(), ModuleLoweringPass { protected val builtIns = context.irBuiltIns<|endoftext|>
// library.kt:42 baz: param:int=6:int, b:int=2:int, inlineCallParam1\1:int=1:int, inlineCallParam2\1:int=2:int, $i$f$inlineCall\1\10:int=0:int, e\1:int=5:int, baz1Param\2:int=1:int,
$i$f$baz1\2\50:int=0:int, baz1Var\2:int=3:int, baz1BlockParam\4:int=1:int, $i$a$-baz1-LibraryKt$inlineCall$1\4\53\1:int=0:int, baz1LambdaVar\4:int=1:int,<|endoftext|>
null -> throw Exception() else -> println(1) } <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.String")!>x<!> <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.String")!>x<!>.length } /* * TESTCASE NUMBER: 6
* UNEXPECTED BEHAVIOUR * ISSUES: KT-24901 */ fun case_6(x: String?) { when (x) { null -> throw Exception() } <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.String")!>x<!><|endoftext|>
open class MyGenericClass<T>(t : T) : MyTrait<T>, MyAbstractClass<T>(), MyProps<T> { override fun foo(t: T) = t override fun bar(t: T) = t override val p : T = t override val pr : T = t } class MyChildClass() : MyGenericClass<Int>(1) {}
class MyChildClass1<T>(t : T) : MyGenericClass<T>(t) {} class MyChildClass2<T>(t : T) : MyGenericClass<T>(t) { fun <!VIRTUAL_MEMBER_HIDDEN!>foo<!>(t: T) = t val <!VIRTUAL_MEMBER_HIDDEN!>pr<!> : T = t<|endoftext|>
Assert.assertTrue(outputs.isNotEmpty()) Assert.assertEquals(File(tmpdir, "Script.class").absolutePath, outputs.first().outputFile?.absolutePath) runScriptWithArgs(getSimpleScriptBaseDir(), "script", "Script", listOf(tmpdir), "hi", "there") } finally {
KotlinCompilerClient.shutdownCompileService(compilerId, daemonOptions) runCatching { logFile.deleteIfExists() } .onFailure { e -> println("Failed to delete log file: $e") } } } } } class TestMessageCollector : MessageCollector {<|endoftext|>
import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.fakeElement import org.jetbrains.kotlin.fir.FirImplementationDetail import org.jetbrains.kotlin.fir.FirModuleData
import org.jetbrains.kotlin.fir.MutableOrEmptyList import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.builder.buildDefaultSetterValueParameter import org.jetbrains.kotlin.fir.expressions.FirAnnotation<|endoftext|>
/** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Int): Int = this.toInt() / other /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */
@kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Long): Long = this.toLong() / other /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Float): Float = this.toFloat() / other<|endoftext|>
@PropertyAnnotation @FieldAnnotation @ParameterAnnotation @UniversalAnnotation @AnotherUniversalAnnotation val x1: Int, @PropertyOrFieldAnnotation val x2: Int, @PropertyOrParameterAnnotation val x3: Int, @ParameterOrFieldAnnotation val x4: Int, @property:UniversalAnnotation @field:AnotherUniversalAnnotation val x5: Int,
@field:UniversalAnnotation @param:AnotherUniversalAnnotation val x6: Int, @param:UniversalAnnotation @property:AnotherUniversalAnnotation val x7: Int ) fun box(): String {<|endoftext|>
override var variable: Int = value override open fun foo(): String = "Not Exported" override val str: String = "test 1" override open fun bar(): Int = 42 } // FILE: exportes.kt @file:JsExport interface I : ParentI { val value: Int var variable: Int fun foo(): String }
class ExportedClass(override val value: Int) : ExtendedI { override var variable: Int = value override fun foo(): String = "Exported" override val str: String = "test 2" override open fun bar(): Int = 43 } class AnotherOne : NotExportedClass(42) { override fun foo(): String = "Another One Exported" }<|endoftext|>
<!WRONG_EXPORTED_DECLARATION("external property getter"), WRONG_EXPORTED_DECLARATION("external property setter")!><!NESTED_JS_EXPORT, WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET("getter; get")!>@get:JsExport<!>
<!NESTED_JS_EXPORT, WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET("setter; set")!>@set:JsExport<!> external var quuux: String<!> <!WRONG_ANNOTATION_TARGET("typealias")!>@JsExport<!><|endoftext|>
package kotlin.io.encoding import kotlin.annotation.AnnotationTarget.* /** * This annotation marks the experimental API for encoding and decoding between binary data and printable ASCII character sequences. * * > Beware using the annotated API especially if you're developing a library, since your library might become binary incompatible * with the future versions of the standard library. *
* Any usage of a declaration annotated with `@ExperimentalEncodingApi` must be accepted either by * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalEncodingApi::class)`, * or by using the compiler argument `-opt-in=kotlin.io.encoding.ExperimentalEncodingApi`. */<|endoftext|>
builder.append(type.lookupTag.name.asString()) } is ConeDynamicType -> { builder.append("dynamic") } is ConeFlexibleType -> { render(type) } is ConeIntersectionType -> { builder.append("it(")
for ((index, intersected) in type.intersectedTypes.withIndex()) { if (index > 0) { builder.append(" & ") } render(intersected) } builder.append(")") } is ConeStubType -> { builder.append("Stub (subtyping): ${type.constructor.variable}") }<|endoftext|>
return super.mark(node, startOffset, endOffset, tree) } if (node.tokenType == KtNodeTypes.IMPORT_DIRECTIVE) { tree.collectDescendantsOfType(node, KtNodeTypes.REFERENCE_EXPRESSION).lastOrNull()?.let { return mark(it, it.startOffset, it.endOffset, tree) } }
if (node.tokenType == KtNodeTypes.TYPE_REFERENCE) { val typeElement = tree.findChildByType(node, KtTokenSets.TYPE_ELEMENT_TYPES) if (typeElement != null) { val referencedTypeExpression = tree.referencedTypeExpression(typeElement) if (referencedTypeExpression != null) {<|endoftext|>
24775, 24904, 24908, 24910, 24908, 24954, 24974, 25010, 24996, 25007, 25054, 25074, 25078, 25104, 25115, 25181,
25265, 25300, 25424, 142092, 25405, 25340, 25448, 25475, 25572, 142321, 25634, 25541, 25513, 14894, 25705, 25726,<|endoftext|>
package org.jetbrains.kotlin.analysis.low.level.api.fir.resolver import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.resolve.calls.ImplicitReceiverValue import org.jetbrains.kotlin.fir.resolve.dfa.* import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.BodyResolveContext<|endoftext|>
valueKotlinType = typeParameterDescriptor.typeConstructor.makeNullableType() valueParameterDescriptor = ValueParameterDescriptorImpl( this, null, 0, Annotations.EMPTY, Name.identifier("arg0"), valueKotlinType, declaresDefaultValue = false, isCrossinline = false, isNoinline = false, varargElementType = null,
source = SourceElement.NO_SOURCE ) returnKotlinType = typeParameterDescriptor.typeConstructor.makeNonNullType() initialize( null, null, listOf(), listOf(typeParameterDescriptor), listOf(valueParameterDescriptor), returnKotlinType, Modality.FINAL, DescriptorVisibilities.PUBLIC ) }<|endoftext|>
PlatformExtensionsClashResolver.FirstWins(AbsentDescriptorHandler::class.java), PlatformDiagnosticSuppressorClashesResolver() ) fun StorageComponentContainer.configureDefaultCheckers() { DEFAULT_DECLARATION_CHECKERS.forEach { useInstance(it) } DEFAULT_CALL_CHECKERS.forEach { useInstance(it) }
DEFAULT_TYPE_CHECKERS.forEach { useInstance(it) } DEFAULT_CLASSIFIER_USAGE_CHECKERS.forEach { useInstance(it) } DEFAULT_ANNOTATION_CHECKERS.forEach { useInstance(it) } DEFAULT_CLASH_RESOLVERS.forEach { useClashResolver(it) } }<|endoftext|>
import org.jetbrains.kotlin.backend.konan.ir.* import org.jetbrains.kotlin.backend.konan.llvm.IntrinsicType import org.jetbrains.kotlin.backend.konan.llvm.tryGetIntrinsicType import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.IrStatement<|endoftext|>
val receiverClass = (owner.type as? IrSimpleType)?.classifier as? IrClassSymbol val receiverClassId = receiverClass?.owner?.classId if (receiverClassId != null) { if (owner.index >= 0) { val labelName = receiverClassId.shortClassName
return CodeFragmentCapturedValue.ContextReceiver(owner.index, labelName, isCrossingInlineBounds = true) } val parent = owner.parent if (parent is IrFunction) { if (parent.dispatchReceiverParameter == owner) { return CodeFragmentCapturedValue.ContainingClass(receiverClassId, isCrossingInlineBounds = true) }<|endoftext|>
var left: Double? get() = definedExternally set(value) = definedExternally var top: Double? get() = definedExternally set(value) = definedExternally } @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly
public inline fun ScrollToOptions(left: Double? = undefined, top: Double? = undefined, behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollToOptions { val o = js("({})") o["left"] = left o["top"] = top o["behavior"] = behavior return o } /**<|endoftext|>
*/ @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Double): Double /** * Returns this value incremented by one. * * @sample samples.misc.Builtins.inc */ public operator fun inc(): Short /**
* Returns this value decremented by one. * * @sample samples.misc.Builtins.dec */ public operator fun dec(): Short /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryPlus(): Int /** Returns the negative of this value. */<|endoftext|>
if (element0 !in 1 downTo 3 != !range0.contains(element0)) throw AssertionError() if (!(element0 in 1 downTo 3) != !range0.contains(element0)) throw AssertionError() if (!(element0 !in 1 downTo 3) != range0.contains(element0)) throw AssertionError() }
fun testR0xE1() { // with possible local optimizations if (0 in 1 downTo 3 != range0.contains(0)) throw AssertionError() if (0 !in 1 downTo 3 != !range0.contains(0)) throw AssertionError() if (!(0 in 1 downTo 3) != !range0.contains(0)) throw AssertionError()<|endoftext|>
return DummyDelegate(element) } } } fun generatedType(type: String, kind: TypeKind = TypeKind.Class): ClassRef<PositionTypeParameterRef> = generatedType("", type, kind) fun generatedType(packageName: String, type: String, kind: TypeKind = TypeKind.Class): ClassRef<PositionTypeParameterRef> {
val realPackage = BASE_PACKAGE + if (packageName.isNotBlank()) ".$packageName" else "" return type(realPackage, type, exactPackage = true, kind = kind) } fun type( packageName: String, type: String, exactPackage: Boolean = false, kind: TypeKind = TypeKind.Interface,<|endoftext|>
if (calleeDescriptor.getUserData(INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION) != null) { userDataMap = LinkedHashMap<CallableDescriptor.UserDataKey<*>, Any>() userDataMap[INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION] =
calleeDescriptor.getUserData(INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION) } } override fun createSubstitutedCopy( newOwner: DeclarationDescriptor, original: FunctionDescriptor?, kind: CallableMemberDescriptor.Kind, newName: Name?, annotations: Annotations,<|endoftext|>
// CHECK_LABELS_COUNT: function=testClassObjectCall name=$l$block count=0 TARGET_BACKENDS=JS_IR fun testClassObjectCall(): String { return InlineAll.inline({"classobject"}) } // CHECK_BREAKS_COUNT: function=testInstanceCall count=0 TARGET_BACKENDS=JS_IR
// CHECK_LABELS_COUNT: function=testInstanceCall name=$l$block count=0 TARGET_BACKENDS=JS_IR fun testInstanceCall(): String { val inlineX = InlineAll() return inlineX.inline({"instance"}) } // CHECK_BREAKS_COUNT: function=testPackageCall count=0 TARGET_BACKENDS=JS_IR<|endoftext|>
// ISSUE: KT-57707 // CHECK_TYPE_WITH_EXACT fun test() { val buildee = build { setTypeVariable(TargetType()) <!RECEIVER_TYPE_MISMATCH("DifferentType; TargetType")!>extensionSetOutProjectedTypeVariable<!>(DifferentType()) } // exact type equality check — turns unexpected compile-time behavior into red code
// considered to be non-user-reproducible code for the purposes of these tests checkExactType<Buildee<TargetType>>(buildee) } class TargetType class DifferentType class Buildee<TV> { fun setTypeVariable(value: TV) { storage = value } private var storage: TV = null!! }<|endoftext|>
assertEquals(110, vInt * 2) } fun testVolatileLong() { assertEquals(777777777, vLong) vLong = 55 assertEquals(55, vLong) } fun testVolatileBoolean() { assertEquals(false, vBoolean) vBoolean = true
assertEquals(true, vBoolean) } fun testVolatileRef() { assertEquals(77, vRef.b.n) vRef = A(B(99)) assertEquals(99, vRef.b.n) } fun testDelegatedVariablesFlow() { _a.lazySet(55)<|endoftext|>
IdeDependsOnDependencyResolver.resolve(jvmMain) .filterIsInstance<IdeaKotlinSourceDependency>() .assertMatches( dependsOnDependency(commonMain), dependsOnDependency(customMain) ) IdeDependsOnDependencyResolver.resolve(customMain)
.filterIsInstance<IdeaKotlinSourceDependency>() .assertMatches(dependsOnDependency(commonMain)) } }<|endoftext|>
"автоплуг", "автопогрузчик", "автоподъёмник", "автопоезд", "автопоилка", "автопокрышка",
"автопортрет", "автопробег", "автопромышленность", "автор", "авторалли", "авторегулятор",<|endoftext|>
override fun containsKey(key: Any?): Boolean = false override fun containsValue(value: Nothing): Boolean = false override fun get(key: Any?): Nothing? = null override val entries: Set<Map.Entry<Any?, Nothing>> get() = EmptySet override val keys: Set<Any?> get() = EmptySet
override val values: Collection<Nothing> get() = EmptyList private fun readResolve(): Any = EmptyMap } /** * Returns an empty read-only map of specified type. * * The returned map is serializable (JVM). * @sample samples.collections.Maps.Instantiation.emptyReadOnlyMap */<|endoftext|>
@WasmOp(WasmOp.EXTERN_EXTERNALIZE) public fun <T : Any> T.toJsReference(): JsReference<T> = implementedAsIntrinsic /** Retrieve original Kotlin value from JsReference */ public fun <T : Any> JsReference<T>.get(): T { returnArgumentIfItIsKotlinAny()
throw ClassCastException("JsReference doesn't contain a Kotlin type") }<|endoftext|>
assertFalse(o.isSubtypeOf(n)) // G<Number> <: G<in Number> assertTrue(n.isSubtypeOf(i)) assertFalse(i.isSubtypeOf(n)) // G<Number> <: G<*> assertTrue(n.isSubtypeOf(st)) assertFalse(st.isSubtypeOf(n))
// G<out Number> <: G<*> assertTrue(o.isSubtypeOf(st)) assertFalse(st.isSubtypeOf(o)) // G<in Number> <: G<*> assertTrue(i.isSubtypeOf(st)) assertFalse(st.isSubtypeOf(i)) return "OK" }<|endoftext|>
x.<!UNRESOLVED_REFERENCE!>getLast<!>() x.<!FUNCTION_CALL_EXPECTED!>last<!> x.last() y.<!DEPRECATION!>getFirst<!>() y.<!DEPRECATION!>first<!> y.first()
y.<!DEPRECATION!>getLast<!>() y.<!DEPRECATION!>last<!> y.last() z.<!DEPRECATION!>getFirst<!>() z.<!FUNCTION_CALL_EXPECTED!>first<!> z.first() z.<!DEPRECATION!>getLast<!>()<|endoftext|>
val KOTLIN_OPTIONS_SUPPRESS_FREEARGS_MODIFICATION_WARNING = property("kotlin.options.suppressFreeCompilerArgsModificationWarning") val KOTLIN_NATIVE_USE_XCODE_MESSAGE_STYLE = property("kotlin.native.useXcodeMessageStyle")
val KOTLIN_INCREMENTAL_USE_CLASSPATH_SNAPSHOT = property("kotlin.incremental.useClasspathSnapshot") val KOTLIN_COMPILER_USE_PRECISE_COMPILATION_RESULTS_BACKUP = property("kotlin.compiler.preciseCompilationResultsBackup")<|endoftext|>
|noArg { | annotation("my.custom.Annotation") |} """.trimMargin() } build(":kaptGenerateStubsKotlin") { assertTasksExecuted(":kaptGenerateStubsKotlin") assertCompilerArgument( ":kaptGenerateStubsKotlin",
"plugin:org.jetbrains.kotlin.noarg:annotation=my.custom.Annotation" ) } } } @DisplayName("KT-59256: kapt generated files are included into the test runtime classpath") @GradleTest fun testKaptGeneratedInTestRuntimeClasspath(gradleVersion: GradleVersion) {<|endoftext|>
"Expected no source directory of 'androidTest' kotlin source set (Unit Test) " + "being present in 'androidTest' Android source set (Instrumented Test)" ) } @Test fun `two product flavor dimensions`() { android.flavorDimensions("pricing", "releaseType") android.productFlavors {
create("beta").dimension = "releaseType" create("production").dimension = "releaseType" create("free").dimension = "pricing" create("paid").dimension = "pricing" } kotlin.androidTarget() project.evaluate() fun assertSourceSetsExist(androidName: String, kotlinName: String) {<|endoftext|>
public class Java2 extends KotlinInternal { public int a = 2; public void foo() {} } // FILE: Java3.java public class Java3 extends KotlinInternal { protected int a = 3; protected void foo() {} } // FILE: Java4.java public class Java4 extends KotlinInternal { private int a = 4; private void foo() {} }
// FILE: Java5.java public class Java5 extends KotlinInternal { int a = 5; void foo(){} } // FILE: test.kt class A : Java1() class B : Java1() { override fun foo() {} override val a: Int get() = 5 } class C : Java2() class D: Java2() {<|endoftext|>
get() = withValidityAssertion { psi.ktVisibility ?: descriptor?.ktVisibility ?: psi.property.ktVisibility ?: Visibilities.Public } override val isDefault: Boolean get() = withValidityAssertion { false } override val isInline: Boolean
get() = withValidityAssertion { psi.hasModifier(KtTokens.INLINE_KEYWORD) || psi.property.hasModifier(KtTokens.INLINE_KEYWORD) } override val isOverride: Boolean get() = withValidityAssertion { psi.property.hasModifier(KtTokens.OVERRIDE_KEYWORD) }<|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 org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.fir.FirModuleData import org.jetbrains.kotlin.fir.builder.FirBuilderDsl import org.jetbrains.kotlin.fir.contracts.FirContractDescription import org.jetbrains.kotlin.fir.declarations.*<|endoftext|>
* Switches Kotlin/Native tasks to using embeddable compiler jar, * allowing to apply backend-agnostic compiler plugin artifacts. * Will be default after proper migration. */ val nativeUseEmbeddableCompilerJar: Boolean get() = booleanProperty("kotlin.native.useEmbeddableCompilerJar") ?: true /**
* Allows a user to set project-wide options that will be passed to the K/N compiler via -Xbinary flag. * E.g. setting kotlin.native.binary.memoryModel=experimental results in passing -Xbinary=memoryModel=experimental to the compiler. * @return a map: property name without `kotlin.native.binary.` prefix -> property value */<|endoftext|>
// Checking for private is not enough because package-private declarations can be hidden, too, if they're in a different package. val dispatchClassSymbol = dispatchClassSymbol ?: return true return session.visibilityChecker.isVisibleForOverriding( dispatchClassSymbol.moduleData, dispatchClassSymbol, member.fir ) }
fun <D : FirCallableSymbol<*>> createIntersectionOverride( mostSpecific: List<MemberWithBaseScope<D>>, extractedOverrides: List<MemberWithBaseScope<D>>, containsMultipleNonSubsumed: Boolean, ): MemberWithBaseScope<FirCallableSymbol<*>> {<|endoftext|>
fun InsnList.asSequence(): Sequence<AbstractInsnNode> = if (size() == 0) emptySequence() else InsnSequence(this) fun MethodNode.prepareForEmitting() { stripOptimizationMarkers() removeEmptyCatchBlocks() // local variables with live ranges starting after last meaningful instruction lead to VerifyError
localVariables = localVariables.filter { lv -> InsnSequence(lv.start, lv.end).any(AbstractInsnNode::isMeaningful) } // We should remove linenumbers after last meaningful instruction // because they point to index of non-existing instruction and it leads to VerifyError var current = instructions.last while (!current.isMeaningful) {<|endoftext|>
package org.jetbrains.kotlin.gradle import org.gradle.testkit.runner.BuildResult import org.gradle.util.GradleVersion import org.jetbrains.kotlin.gradle.testbase.* import org.junit.jupiter.api.DisplayName @DisplayName("Tasks don't have unnamed inputs and outputs")
class UnnamedTaskInputsIT : KGPBaseTest() { override val defaultBuildOptions: BuildOptions get() = super.defaultBuildOptions.copy(buildCacheEnabled = true) private val localBuildCacheDir get() = workingDir.resolve("custom-jdk-build-cache-2") @JvmGradlePluginTests @DisplayName("JVM")<|endoftext|>
* Exposes the JavaScript [HTMLAudioElement](https://developer.mozilla.org/en/docs/Web/API/HTMLAudioElement) to Kotlin */ public external abstract class HTMLAudioElement : HTMLMediaElement { companion object { val NETWORK_EMPTY: Short val NETWORK_IDLE: Short val NETWORK_LOADING: Short val NETWORK_NO_SOURCE: Short
val HAVE_NOTHING: Short val HAVE_METADATA: Short val HAVE_CURRENT_DATA: Short val HAVE_FUTURE_DATA: Short val HAVE_ENOUGH_DATA: Short val ELEMENT_NODE: Short val ATTRIBUTE_NODE: Short val TEXT_NODE: Short val CDATA_SECTION_NODE: Short<|endoftext|>
// KJS_WITH_FULL_RUNTIME // EXPECTED_REACHABLE_NODES: 1525 package foo // CHECK_NOT_CALLED_IN_SCOPE: scope=test function=even TARGET_BACKENDS=JS // CHECK_NOT_CALLED_IN_SCOPE: scope=test function=filter TARGET_BACKENDS=JS
internal inline fun even(x: Int) = x % 2 == 0 internal fun test(a: List<Int>) = a.filter(::even) fun box(): String { assertEquals(listOf(2, 4), test(listOf(1, 2, 3, 4))) return "OK" }<|endoftext|>
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.STRICTFP_ON_CLASS import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.SUBCLASS_CANT_CALL_COMPANION_PROTECTED_NON_STATIC
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.SUSPENSION_POINT_INSIDE_CRITICAL_SECTION import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.SYNCHRONIZED_IN_INTERFACE<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("Out<out kotlin.Int?> & Out<out kotlin.Int?>?")!>x<!>.equals(null) <!DEBUG_INFO_EXPRESSION_TYPE("Out<out kotlin.Int?> & Out<out kotlin.Int?>?")!>x<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("Out<out kotlin.Int?> & Out<out kotlin.Int?>?")!>x<!>.propAny <!DEBUG_INFO_EXPRESSION_TYPE("Out<out kotlin.Int?> & Out<out kotlin.Int?>?")!>x<!>.propNullableT<|endoftext|>
fun PrintWriter.propertyDiffTable(header1: String, header2: String, propertyDiffs: List<NamedDiffEntry>) { if (propertyDiffs.isNotEmpty()) { table { tableHeader("Property", header1, header2) for (pd in propertyDiffs) {
tableData(pd.name, pd.value1.toHtmlString().withTag("code"), pd.value2.toHtmlString().withTag("code")) } } println("&nbsp;") } } fun PrintWriter.annotationDiffTable(header1: String, header2: String, annotationDiffs: List<NamedDiffEntry>) {<|endoftext|>
val mode = when (val firstByte = b.readByte().toInt()) { 0 -> WasmDataMode.Active(0, readExpression()) 1 -> WasmDataMode.Passive 2 -> WasmDataMode.Active(b.readVarUInt32AsInt(), readExpression()) else -> error("Unsupported data mode $firstByte") }
val size = b.readVarUInt32AsInt() val bytes = b.readBytes(size) data += WasmData(mode, bytes) } } // Data count section 12 -> { b.readVarUInt32() // Data count dataCount = true } } } } return WasmModule(<|endoftext|>
// FIR_IDENTICAL annotation class AnnE(val i: String) enum class MyEnum { A } @AnnE(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>"1" + MyEnum.A<!>) class Test
@AnnE(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>"1" + MyEnum::class<!>) class Test2 @AnnE(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>"1" + AnnE("23")<!>) class Test3<|endoftext|>
if (!(element3 in 1L until 3L) != !range0.contains(element3)) throw AssertionError() if (!(element3 !in 1L until 3L) != range0.contains(element3)) throw AssertionError() } fun testR0xE4() { // with possible local optimizations
if (0.toByte() in 1L until 3L != range0.contains(0.toByte())) throw AssertionError() if (0.toByte() !in 1L until 3L != !range0.contains(0.toByte())) throw AssertionError()<|endoftext|>
override val directFriendDependencies: List<KtModule> = emptyList(), override val platform: TargetPlatform = JvmPlatforms.defaultJvmPlatform, override val project: Project, override val file: KtFile, override val languageVersionSettings: LanguageVersionSettings ) : KtScriptModule, KtModuleWithPlatform {
override val transitiveDependsOnDependencies: List<KtModule> by lazy { computeTransitiveDependsOnDependencies(directDependsOnDependencies) } override val analyzerServices: PlatformDependentAnalyzerServices get() = super.analyzerServices override val contentScope: GlobalSearchScope get() = GlobalSearchScope.fileScope(file)<|endoftext|>
class WasmInstrWithoutLocation( operator: WasmOp, immediates: List<WasmImmediate> = emptyList(), ) : WasmInstr(operator, immediates) { override val location: SourceLocation? get() = null } data class WasmLimits( val minSize: UInt, val maxSize: UInt? )
data class WasmImportDescriptor( val moduleName: String, val declarationName: String )<|endoftext|>
<!USELESS_IS_CHECK!>is A<!> -> 1 is SubA -> 1 is B -> 1 <!USELESS_IS_CHECK!>is SubB<!> -> 1 is SubAandB -> 1 } return i } fun test(b: B): Int { var i = 0
i += <!NO_ELSE_IN_WHEN!>when<!>(b) { is SubAandB -> 1 } i += when(b) { is SubB -> 1 is SubAandB -> 1 } i += <!NO_ELSE_IN_WHEN!>when<!>(b) {<|endoftext|>
return@loop } sdks += sdk val podInstallTask = project.tasks.named<PodInstallSyntheticTask>(target.konanTarget.family.toPodInstallSyntheticTaskName) project.registerTask<PodSetupBuildTask>(sdk.toSetupBuildTaskName(pod)) { task -> task.group = TASK_GROUP
task.description = "Collect environment variables from .xcworkspace file" task.pod.set(pod) task.sdk.set(sdk) task.podsXcodeProjDir.set(podInstallTask.map { it.podsXcodeProjDirProvider.get() }) task.frameworkName.set(cocoapodsExtension.podFrameworkName)<|endoftext|>