prompt
stringlengths
1
924
completion
stringlengths
14
937
return u1 // box } ULong(-1) } fun foo(): Boolean = true fun labeled(): ULong<Long>? { val u = ULong(2) return run { if (foo()) return@run u ULong(-1) // box } } fun box(): String {
if (nonLocal()!!.l != 1L) return "fail" if (labeled()!!.l != 2L) return "fail" return "OK" }<|endoftext|>
val LOMBOK_COMPILER_PLUGIN_ID = "org.jetbrains.kotlin.lombok" @Component(role = KotlinMavenPluginExtension::class, hint = "lombok") class KotlinLombokMavenPluginExtension : KotlinMavenPluginExtension { @Requirement lateinit var logger: Logger
override fun getCompilerPluginId() = LOMBOK_COMPILER_PLUGIN_ID override fun isApplicable(project: MavenProject, execution: MojoExecution) = true override fun getPluginOptions(project: MavenProject, execution: MojoExecution): List<PluginOption> { logger.debug("Loaded Maven plugin " + javaClass.name)<|endoftext|>
class C { class Nested inner class Inner } fun box(): String { assertEquals(3, A::class.constructors.size) assertEquals(1, B::class.constructors.size) assertTrue(Collections.disjoint(A::class.members, A::class.constructors))
assertTrue(Collections.disjoint(B::class.members, B::class.constructors)) assertEquals(1, C.Nested::class.constructors.size) assertEquals(1, C.Inner::class.constructors.size) return "OK" }<|endoftext|>
/** * Exposes the JavaScript [ServiceWorkerRegistration](https://developer.mozilla.org/en/docs/Web/API/ServiceWorkerRegistration) to Kotlin */ public external abstract class ServiceWorkerRegistration : EventTarget, JsAny { open val installing: ServiceWorker? open val waiting: ServiceWorker? open val active: ServiceWorker? open val scope: String
open var onupdatefound: ((Event) -> Unit)? open val APISpace: JsAny? fun update(): Promise<Nothing?> fun unregister(): Promise<JsBoolean> fun showNotification(title: String, options: NotificationOptions = definedExternally): Promise<Nothing?> fun getNotifications(filter: GetNotificationOptions = definedExternally): Promise<JsArray<Notification>><|endoftext|>
val name = ktEnumEntry.name ?: continue result.add( KtUltraLightEnumEntry( ktEnumEntry, name, this, support, setOf(PsiModifier.STATIC, PsiModifier.FINAL, PsiModifier.PUBLIC) ) ) } } result.updateWithCompilerPlugins() }
private fun isNamedObject() = classOrObject is KtObjectDeclaration && !classOrObject.cast<KtObjectDeclaration>().isCompanion() override fun getOwnFields(): List<KtLightField> = _ownFields private fun propertyParameters() = classOrObject.primaryConstructorParameters.filter { it.hasValOrVar() }<|endoftext|>
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.kotlin.jps.incremental import com.intellij.util.containers.ContainerUtil import org.jetbrains.jps.ModuleChunk
import org.jetbrains.jps.builders.BuildTargetRegistry import org.jetbrains.jps.builders.DirtyFilesHolder import org.jetbrains.jps.builders.JpsBuildBundle import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor import org.jetbrains.jps.incremental.BuilderCategory<|endoftext|>
fun CompilerConfiguration.updateWithBaseCompilerArguments() { getBaseCompilerArgumentsFromProperty()?.let { updateWithCompilerOptions(it) } } fun expectTestToFailOnK2(test: () -> Unit) {
val isK2 = System.getProperty(SCRIPT_BASE_COMPILER_ARGUMENTS_PROPERTY)?.contains("-language-version 1.9") != true && System.getProperty(SCRIPT_TEST_BASE_COMPILER_ARGUMENTS_PROPERTY)?.contains("-language-version 1.9") != true<|endoftext|>
Splits this ${f.collection} into a ${f.mapResult} of ${f.snapshotResult.pluralize()} each not exceeding the given [size]. The last ${f.snapshotResult} in the resulting ${f.mapResult} may have fewer ${f.element.pluralize()} than the given [size].
@param size the number of elements to take in each ${f.snapshotResult}, must be positive and can be greater than the number of elements in this ${f.collection}. """ } specialFor(Iterables, Sequences) { sample("samples.collections.Collections.Transformations.chunked") }<|endoftext|>
stabilityInferencer: StabilityInferencer, private val strongSkippingModeEnabled: Boolean, private val intrinsicRememberEnabled: Boolean, private val nonSkippingGroupOptimizationEnabled: Boolean, ) : AbstractComposeLowering(context, symbolRemapper, metrics, stabilityInferencer), ModuleLoweringPass {
private val declarationContextStack = mutableListOf<DeclarationContext>() private val currentFunctionContext: FunctionContext? get() = declarationContextStack.peek()?.functionContext private var composableSingletonsClass: IrClass? = null private var currentFile: IrFile? = null<|endoftext|>
import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.hasExpectModifier import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall import org.jetbrains.kotlin.resolve.descriptorUtil.module import org.jetbrains.kotlin.resolve.multiplatform.findCompatibleExpectsForActual<|endoftext|>
h.value += ", OK_EXCEPTION1" return "OK_EXCEPTION1" }, { h.value += ", OK_EXCEPTION2" return "OK_EXCEPTION2" }, { try { h.value += ", OK_FINALLY" throw RuntimeException("FINALLY") "OK_FINALLY" } finally {
h.value += ", OK_FINALLY_INNER" } }) return localResult; } catch (e: RuntimeException) { if (e.message != "FINALLY") { return "FAIL in exception: " + e.message } else { return "CATCHED_EXCEPTION" } }<|endoftext|>
assertEquals(EvaluateBuildscript, stage) await(AfterEvaluateBuildscript) assertEquals(AfterEvaluateBuildscript, stage) await(FinaliseDsl) assertEquals(FinaliseDsl, stage) await(FinaliseRefinesEdges) assertEquals(FinaliseRefinesEdges, stage)
assertFailsWith<IllegalLifecycleException> { await(AfterFinaliseRefinesEdges) } } } } @Test fun `test - launching in AfterEvaluate`() = project.runLifecycleAwareTest { val actionInvocations = AtomicInteger(0) afterEvaluate { launch {<|endoftext|>
val a = A() if (a.foo<Any>() != a) return "Fail 5" if (a.foo<Any?>() != a) return "Fail 6" if (a.foo<A>() != a) return "Fail 7" if (a.foo<A?>() != a) return "Fail 8" val b = B()
failClassCast { b.foo<A>(); return "Fail 9" } failClassCast { b.foo<A?>(); return "Fail 10" } return "OK" } inline fun failNPE(s: () -> Unit) { try { s() } catch (e: NullPointerException) { // OK } }<|endoftext|>
if (x.isEqualsCalled && !y.isEqualsCalled) return "OK" } return "NOK" } fun checkNotEquals(A: Any?, B: Any?): Boolean { return !((A as? Any)?.equals(B) ?: (B === null)) } data class A(val a: Boolean) {
var isEqualsCalled = false override operator fun equals(anObject: Any?): Boolean { isEqualsCalled = true if (this === anObject) { return true } if (anObject is A) { if (anObject.a == a) return true } return false } }<|endoftext|>
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.VAL_OR_VAR_ON_LOOP_PARAMETER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.VAL_OR_VAR_ON_SECONDARY_CONSTRUCTOR_PARAMETER
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.VAL_REASSIGNMENT import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.VAL_REASSIGNMENT_VIA_BACKING_FIELD<|endoftext|>
private fun parseOptions(options: String) = SimpleExternalDependenciesResolverOptionsParser(options).valueOrThrow() private val resolvedKotlinVersion = "1.5.31" fun testDefaultSettings() { val settings = createMavenSettings() assertNotNull(settings.localRepository) } fun testResolveSimple() {
resolveAndCheck("org.jetbrains.kotlin:kotlin-annotations-jvm:$resolvedKotlinVersion") { files -> files.any { it.name.startsWith("kotlin-annotations-jvm") } } } fun testResolveWithRuntime() { // Need a minimal library with an extra runtime dependency<|endoftext|>
val kotlinType = declaration.getKotlinType() ?: return@lazyPub PsiType.NULL val descriptor = variableDescriptor ?: return@lazyPub PsiType.NULL support.mapType(kotlinType, this) { typeMapper, sw -> typeMapper.writeFieldSignature(kotlinType, descriptor, sw) } } }
} override fun getType(): PsiType = _type override fun getParent() = containingClass override fun getContainingClass() = containingClass override fun getContainingFile(): PsiFile? = containingClass.containingFile private val _initializer by lazyPub { _constantInitializer?.createPsiLiteral(declaration) }<|endoftext|>
} catch (e: Exception) { return } if (x != null) { x.inc() y<!UNSAFE_CALL!>.<!>inc() } if (y != null) { x<!UNSAFE_CALL!>.<!>inc() y.inc() } }
fun test5(x: Int?) { val y = try { x } catch (e: ExcA) { return } catch (e: ExcB) { x } if (x != null) { x.inc() y<!UNSAFE_CALL!>.<!>inc() }<|endoftext|>
private fun insertLoweredDeclarationForLocalFunctions() { localFunctions.values.forEach { localContext -> localContext.transformedDeclaration.apply { val original = localContext.declaration this.body = original.body this.body?.let { localContext.remapTypes(it) }
original.valueParameters.filter { v -> v.defaultValue != null }.forEach { argument -> val body = argument.defaultValue!! localContext.remapTypes(body) oldParameterToNew[argument]!!.defaultValue = body } acceptChildren(SetDeclarationsParentVisitor, this) }<|endoftext|>
y = <!ASSIGNMENT_TYPE_MISMATCH!>x<!> } require(x is String) y.length } } fun test21(x: Any?) { var y: Any runWithoutContract { if (x != null) { y = x } else {
y = <!ASSIGNMENT_TYPE_MISMATCH!>x<!> } require(x is String) <!SMARTCAST_IMPOSSIBLE!>y<!>.length } } fun test22(x: Any) { var y: Any = materialize() runWithoutContract { require(x is String) y = x }<|endoftext|>
public static TargetType RAW() { return new TargetType<String>(); } } } // FILE: kotlin.kt fun <T> accept(arg: T) {} fun test() { // jspecify_nullness_mismatch
accept<String>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>NullMarkedType.TargetType.TYPE_ARGUMENT().produce()<!>) // jspecify_nullness_mismatch<|endoftext|>
package org.jetbrains.kotlin.scripting.compiler.plugin.impl import org.jetbrains.kotlin.cli.common.arguments.Argument import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.diagnostics.KtDiagnostic<|endoftext|>
@GradleTest @DisplayName("Verify default compiler dependencies") fun defaultClasspath(gradleVersion: GradleVersion) { prepareProject(gradleVersion) { build(printClasspathTaskName) { assertCompilerVersion(buildOptions.kotlinVersion) } } } @GradleTest
@DisplayName("Compiler version may be specified via the kotlin extension") fun compilerVersionMayBeChanged(gradleVersion: GradleVersion) { prepareProject(gradleVersion) { chooseCompilerVersion(TestVersions.Kotlin.STABLE_RELEASE) build(printClasspathTaskName) { assertCompilerVersion(TestVersions.Kotlin.STABLE_RELEASE)<|endoftext|>
fun <@Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>"type param $prop"<!>) F : @Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>"bound $prop"<!>)
List<@Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>"nested bound $prop"<!>) List<@Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>"nested nested bound $prop"<!>) String>>><|endoftext|>
val paths = getList(option).asMutableList() paths.add(value) put(option, paths) } fun <T> CompilerConfiguration.appendList(option: CompilerConfigurationKey<List<T>>, values: List<T>) { val paths = getList(option).asMutableList() paths.addAll(values)
put(option, paths) } fun CompilerConfiguration.applyOptionsFrom(map: Map<String, List<String>>, pluginOptions: Collection<AbstractCliOption>) { for ((key, values) in map) { val option = pluginOptions.firstOrNull { it.optionName == key } ?: continue for (value in values) { processOption(option, value, this)<|endoftext|>
declaration.symbol.callableId.packageName == useSiteFile.packageFqName } else -> { // Member: visible inside parent class, including all its member classes canSeePrivateMemberOf( symbol, containingDeclarations, ownerLookupTag, dispatchReceiver, isVariableOrNamedFunction = symbol.isVariableOrNamedFunction(), session
) } } } else { declaration is FirSimpleFunction && declaration.isAllowedToBeAccessedFromOutside() } } Visibilities.Protected -> { val ownerId = symbol.getOwnerLookupTag() ownerId != null && canSeeProtectedMemberOf( symbol, containingDeclarations, dispatchReceiver, ownerId, session,<|endoftext|>
fun case_5(value_1: Any?, value_2: Int?, value_3: Any?, value_4: Int?, value_5: Any?, value_6: Int?) { when { value_1.case_5_1(value_2) -> { println(<!DEBUG_INFO_SMARTCAST!>value_1<!>.length)
println(<!DEBUG_INFO_SMARTCAST!>value_2<!>.inv()) } } when { !value_3.case_5_2(value_4) -> { println(<!DEBUG_INFO_SMARTCAST!>value_3<!>.length)<|endoftext|>
@kotlin.SinceKotlin(version = "1.4") @kotlin.ExperimentalUnsignedTypes @kotlin.internal.InlineOnly public inline fun kotlin.UByteArray.reverse(fromIndex: kotlin.Int, toIndex: kotlin.Int): kotlin.Unit @kotlin.SinceKotlin(version = "1.3")
@kotlin.ExperimentalUnsignedTypes @kotlin.internal.InlineOnly public inline fun kotlin.UIntArray.reverse(): kotlin.Unit @kotlin.SinceKotlin(version = "1.4") @kotlin.ExperimentalUnsignedTypes @kotlin.internal.InlineOnly<|endoftext|>
if (type1.ordinal > type2.ordinal) type1 else type2 private fun getOperatorReturnType(type1: UnsignedType, type2: UnsignedType): UnsignedType { return maxByDomainCapacity(maxByDomainCapacity(type1, type2), UnsignedType.UINT) } }
class UnsignedArrayGenerator(val type: UnsignedType, out: PrintWriter) : BuiltInsSourceGenerator(out) { private val elementType = type.capitalized private val arrayType = elementType + "Array" private val arrayTypeOf = elementType.lowercase() + "ArrayOf" private val storageElementType = type.asSigned.capitalized<|endoftext|>
<!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T> testTypeParameterWithMultipleTypeAliasedUpperBoundsBAAReverse()<!> where T: SameUserInterfaceA, T: SameUserInterfaceB {}
<!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T> testTypeParameterWithMultipleTypeAliasedUpperBoundsBAB(arg: T)<!> where T: UserInterfaceA, T: UserInterfaceB {}<|endoftext|>
fun clang_getCompletionBriefComment(completion_string: CXCompletionString?): CValue<CXString> { val kniRetVal = nativeHeap.alloc<CXString>() try { kniBridge279(completion_string.rawValue, kniRetVal.rawPtr) return kniRetVal.readValue()
} finally { nativeHeap.free(kniRetVal) } } fun clang_getCursorCompletionString(cursor: CValue<CXCursor>): CXCompletionString? { memScoped { return interpretCPointer<COpaque>(kniBridge280(cursor.getPointer(memScope).rawValue)) } }<|endoftext|>
actual class A<T> { actual inner class B<N> { actual fun <H> foo(t: T, n: N, h: H, a: (T, N, H) -> Int) = a(t, n, h).toString() } } // MODULE: main(lib) // FILE: main.kt import kotlin.test.assertEquals
fun box(): String { assertEquals("1", topLevel("OK")) assertEquals("73", topLevel("OK") { 73 }) val foo = Foo() assertEquals("2", foo.member("OK")) assertEquals("42", foo.member("OK") { 42 }) val bar = Bar<String>() assertEquals("3", bar.member("OK"))<|endoftext|>
} if (declaration is KtClassOrObject) { val primaryConstructor = declaration.primaryConstructor if (primaryConstructor != null) { f(primaryConstructor) } declaration.declarations.forEach { doForEachDeclaration(it, f) } } }
private fun doForEachDeclaration(files: Collection<KtFile>, f: (KtDeclaration) -> Unit) { for (file in files) { file.declarations.forEach { doForEachDeclaration(it, f) } } } }<|endoftext|>
val cursorReturnType = clang_getCursorResultType(cursor) if (cursorReturnType.name.isUnknownTemplate()) return null var returnType = convertType(cursorReturnType, clang_getCursorResultTypeAttributes(cursor)) val parameters = mutableListOf<Parameter>() parameters += getFunctionParameters(cursor) ?: return null
val binaryName = when (library.language) { Language.C, Language.CPP, Language.OBJECTIVE_C -> clang_Cursor_getMangling(cursor).convertAndDispose() } val definitionCursor = clang_getCursorDefinition(cursor) val isDefined = (clang_Cursor_isNull(definitionCursor) == 0)<|endoftext|>
// !LANGUAGE: +UnrestrictedBuilderInference // !DIAGNOSTICS: -UNUSED_PARAMETER -OPT_IN_IS_NOT_ENABLED -UNUSED_VARIABLE // WITH_STDLIB // FILE: Test.java class Test { static <T> T foo(T x) { return x; } } // FILE: main.kt
import kotlin.experimental.ExperimentalTypeInference @OptIn(ExperimentalTypeInference::class) fun <R> build(block: TestInterface<R>.() -> Unit): R = TODO() @OptIn(ExperimentalTypeInference::class) fun <R> build2(block: TestInterface<R>.() -> Unit): R = TODO() class Inv<K><|endoftext|>
//patch for jack&jill if (oldStartLabel === start) newBodyStartLabel else start, end, index ) } }) constructorVisitor.visitEnd() } private fun getMethodParametersWithCaptured(capturedBuilder: ParametersBuilder, sourceNode: MethodNode): Parameters { val builder = ParametersBuilder.newBuilder()
if (sourceNode.access and Opcodes.ACC_STATIC == 0) { builder.addThis(oldObjectType, skipped = false) } for (type in Type.getArgumentTypes(sourceNode.desc)) { builder.addNextParameter(type, false) } for (param in capturedBuilder.listCaptured()) { builder.addCapturedParamCopy(param)<|endoftext|>
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { if (descriptor !is MemberDescriptor || !descriptor.isExternal) return val trace = context.trace if (descriptor !is FunctionDescriptor) { val target = when (descriptor) { is PropertyDescriptor -> "property"
is ClassDescriptor -> "class" else -> "non-function declaration" } declaration.modifierList?.getModifier(KtTokens.EXTERNAL_KEYWORD)?.let { trace.report(Errors.WRONG_MODIFIER_TARGET.on(it, KtTokens.EXTERNAL_KEYWORD, target)) } return }<|endoftext|>
public inline fun kotlin.UShortArray.elementAtOrElse(index: kotlin.Int, defaultValue: (kotlin.Int) -> kotlin.UShort): kotlin.UShort public fun <T> kotlin.collections.Iterable<T>.elementAtOrElse(index: kotlin.Int, defaultValue: (kotlin.Int) -> T): T
@kotlin.internal.InlineOnly public inline fun <T> kotlin.collections.List<T>.elementAtOrElse(index: kotlin.Int, defaultValue: (kotlin.Int) -> T): T @kotlin.internal.InlineOnly public inline fun <T> kotlin.Array<out T>.elementAtOrNull(index: kotlin.Int): T?<|endoftext|>
if (applicability == CandidateApplicability.RESOLVED) break val name = qualifier.first().name val processor = { symbol: FirClassifierSymbol<*>, substitutorFromScope: ConeSubstitutor -> val resolvedSymbol = resolveSymbol(symbol, qualifier, qualifierResolver) if (resolvedSymbol != null) {
processCandidate(resolvedSymbol, substitutorFromScope) } } if (scope is FirDefaultStarImportingScope) { scope.processClassifiersByNameWithSubstitutionFromBothLevelsConditionally(name) { symbol, substitutor -> processor(symbol, substitutor) applicability == CandidateApplicability.RESOLVED } } else {<|endoftext|>
package org.jetbrains.kotlin.gradle.native import com.intellij.testFramework.TestDataFile import org.gradle.api.logging.LogLevel import org.gradle.testkit.runner.BuildResult import org.gradle.util.GradleVersion import org.jdom.input.SAXBuilder
import org.jetbrains.kotlin.gradle.internals.KOTLIN_NATIVE_IGNORE_DISABLED_TARGETS_PROPERTY import org.jetbrains.kotlin.gradle.plugin.diagnostics.KotlinToolingDiagnostics import org.jetbrains.kotlin.gradle.plugin.mpp.NativeOutputKind<|endoftext|>
package androidx.compose.compiler.plugins.kotlin import com.intellij.openapi.util.io.FileUtil import java.io.ByteArrayOutputStream import java.io.File import java.io.PrintStream import java.io.PrintWriter import org.intellij.lang.annotations.Language
import org.jetbrains.kotlin.cli.common.CLICompiler import org.jetbrains.kotlin.cli.common.CLITool import org.jetbrains.kotlin.cli.common.ExitCode import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler import org.jetbrains.org.objectweb.asm.ClassReader<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!><!UNSAFE_CALL!>.<!>equals(null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!><!UNSAFE_CALL!>.<!>propAny <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!>.propNullableT<|endoftext|>
override fun withLinuxArm64() = withTargets { it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_ARM64 } @Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR) override fun withWatchosX86() = Unit
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR) override fun withMingwX86() = Unit @Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR) override fun withLinuxArm32Hfp() = Unit<|endoftext|>
require(DPoint::suspendInlineFunctionWithLambda == DPoint::suspendInlineFunctionWithLambda) require(dPoint::suspendInlineFunctionWithLambda == any8(dPoint)) require(DPoint::suspendInlineFunctionWithLambda == any8()) require(::g == ::g) require(a::f == a::f)
require(A::f == A::f) require(DPoint::plus == DPoint::plus) require(dPoint.let { DPoint(it.x * 2, it.y * 2) } == DPoint(2.0, 4.0)) require(dPoint.let(::id) == DPoint(1.0, 2.0))<|endoftext|>
fun setAddAll(index: Int, elements: FastArrayList<E>, offset: Int = 0, size: Int = elements.size - offset) {} fun setAll(index: Int, elements: FastArrayList<E>, offset: Int = 0, size: Int = elements.size - offset) {}
fun addAll(elements: FastArrayList<E>, offset: Int = 0, size: Int = elements.size - offset) {} fun removeToSize(size: Int) {} } expect class FastArrayList<E> : MutableListEx<E>, RandomAccess { constructor() constructor(initialCapacity: Int) constructor(elements: Collection<E>)<|endoftext|>
fun test_5(x: Inv<in Number>, list: List<Inv<Number>>) { list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x) } fun test_6(x: Inv<in Number>, list: List<Inv<Int>>) {
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x) } fun test_7(x: Inv<out Number>, list: List<Inv<Any>>) { list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x) }<|endoftext|>
// library.kt:28 baz: param:int=6:int, b:int=2:int, inlineCallParam1\9:int=1:int, inlineCallParam2\9:int=2:int, $i$f$inlineCall\9\14:int=0:int, e\9:int=5:int, baz1Param\10:int=1:int,
$i$f$baz1\10\79:int=0:int, baz1Var\10:int=3:int, baz1BlockParam\12:int=1:int, $i$a$-baz1-LibraryKt$inlineCall$1\12\82\9:int=0:int<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<kotlin.Int>? & Inv<kotlin.Int>")!>x<!>.funNullableT() <!DEBUG_INFO_EXPRESSION_TYPE("Inv<kotlin.Int>? & Inv<kotlin.Int>")!>x<!>.funNullableAny() } }
// TESTCASE NUMBER: 8 fun case_8(x: ClassWithThreeTypeParameters<Int?, Short?, ClassWithThreeTypeParameters<Int?, Short?, String?>?>?) { if (x != null) {<|endoftext|>
// WITH_STDLIB /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * * SPEC VERSION: 0.1-268 * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4 * overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1<|endoftext|>
val structPointerFromPosix = getStructPointerFromPosix() object MyStruct { val struct = getMyStructPointer()?.pointed ?: error("Missing my struct") val posixProperty: stat = struct.posixProperty val longProperty: Long = struct.longProperty val doubleProperty: Double = struct.doubleProperty } val simple = simpleInterop()
val p1 = NativeMain.structFromPosix }<|endoftext|>
// FILE: Lib2.kt package libPackageCase1Explicit public fun <T> emptyArray(): Array<T> = TODO() // FILE: LibtestsPack1.kt package testsCase1 public fun <T> emptyArray(): Array<T> = TODO() // FILE: TestCase2.kt // TESTCASE NUMBER: 2 package testsCase2
import libPackageCase2.* import libPackageCase2Explicit.emptyArray fun case2() { <!DEBUG_INFO_CALL("fqName: libPackageCase2Explicit.emptyArray; typeCall: function")!>emptyArray<Int>()<!> } class A { operator fun <T>invoke(): T = TODO() } // FILE: Lib3.kt<|endoftext|>
predicate: (LighterASTNode) -> Boolean = { true } ): List<LighterASTNode> { val result = mutableListOf<LighterASTNode>() fun FlyweightCapableTreeStructure<LighterASTNode>.collectDescendantByType(node: LighterASTNode) { val childrenRef = Ref<Array<LighterASTNode?>>()
getChildren(node, childrenRef) val childrenRefGet = childrenRef.get() if (childrenRefGet != null) { for (child in childrenRefGet) { if (child?.tokenType == type && predicate(child)) { result.add(child) } if (child != null) { collectDescendantByType(child) } }<|endoftext|>
<!UNSUPPORTED_FEATURE!>context(String, Int)<!> fun m() {} } fun useWithContextReceivers() { with(42) { with("") { f({}, 42) <!UNSUPPORTED_CONTEXTUAL_DECLARATION_CALL!>sameAsFWithoutNonContextualCounterpart<!>({}, 42)
<!UNSUPPORTED_CONTEXTUAL_DECLARATION_CALL!>p<!> val a = <!UNSUPPORTED_CONTEXTUAL_DECLARATION_CALL!>A<!>() a.<!UNSUPPORTED_CONTEXTUAL_DECLARATION_CALL!>p<!><|endoftext|>
override fun expectFailure(failurePattern: FailurePattern, block: Block<Any?>) { tests += FailingTest(failurePattern as AbstractFailurePattern, block) } override fun expectSuccess(block: Block<String>) = expectSuccess(OK_STATUS, block) override fun <T : Any> expectSuccess(expectedOutcome: T, block: Block<T>) {
tests += SuccessfulTest(expectedOutcome, block) } fun check() { check(tests.isNotEmpty()) { "No ABI tests configured" } } fun runTests(): String { val testFailures: List<TestFailure> = tests.mapIndexedNotNull { serialNumber, test -> val testFailureDetails: TestFailureDetails? = when (test) {<|endoftext|>
// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // KT-12751 Type inference failed with forEach and bound reference class L<out T> fun <T> L<T>.foo(action: (T) -> Unit): Unit {} class B { fun remove(charSequence: CharSequence) {} }
fun foo(list: L<CharSequence>, b: B) { list.foo(b::remove) list.foo<CharSequence>(b::remove) }<|endoftext|>
fun `test - no hierarchy descriptor applied - when a custom dependsOn edge was configured`() = buildProjectWithMPP().runLifecycleAwareTest { val kotlin = multiplatformExtension kotlin.jvm() kotlin.sourceSets.jvmMain.get().dependsOn(kotlin.sourceSets.commonMain.get())
launchInStage(KotlinPluginLifecycle.Stage.ReadyForExecution) { if (kotlin.hierarchy.appliedTemplates.isNotEmpty()) { fail("Expected *no* hierarchy template to be applied") } } } @Test fun `test - no hierarchy descriptor applied - when a targetName clashes with a default group`() {<|endoftext|>
is FirClassLikeSymbol<*> -> symbol.classId.shortClassName else -> return@Renderer "???" } name.asString() } val RENDER_CLASS_OR_OBJECT_QUOTED = Renderer { classSymbol: FirClassSymbol<*> -> val name = classSymbol.classId.relativeClassName.asString()
val classOrObject = when (classSymbol.classKind) { ClassKind.OBJECT -> "Object" ClassKind.INTERFACE -> "Interface" else -> "Class" } "$classOrObject '$name'" } val RENDER_ENUM_ENTRY_QUOTED = Renderer { enumEntry: FirEnumEntrySymbol -><|endoftext|>
"kotlin.Byte" -> return (a as Float).div(b as Byte) "kotlin.Double" -> return (a as Float).div(b as Double) "kotlin.Float" -> return (a as Float).div(b as Float) "kotlin.Int" -> return (a as Float).div(b as Int)
"kotlin.Long" -> return (a as Float).div(b as Long) "kotlin.Short" -> return (a as Float).div(b as Short) } "kotlin.Long" -> when (typeB) { "kotlin.Byte" -> return (a as Long).div(b as Byte)<|endoftext|>
// library.kt:7 box: $i$f$flaf:int=0:int, flafVar$iv:int=0:int, fooParam\1$iv:int=0:int, $i$f$foo\1\12:int=0:int, fooVar\1$iv:int=0:int, it\2$iv:int=42:int,
$i$a$-foo-LibraryKt$flaf$1\2\25\0$iv:int=0:int, x\2$iv:int=1:int, fooParam\5$iv:int=2:int, $i$f$foo\5\17:int=0:int, fooVar\5$iv:int=0:int<|endoftext|>
val bitsWithPaddingPtr = bitcast(pointerType(bitsWithPaddingType), gep(llvm.int8Type, ptr, llvm.int64(offset / 8))) val bits = trunc(value, bitsType) val bitsToStore = if (prefixBitsNum == 0 && suffixBitsNum == 0) { bits } else {
val previousValue = load(bitsWithPaddingType, bitsWithPaddingPtr).setUnaligned() val preservedBits = and(previousValue, preservedBitsMask) val bitsWithPadding = shl(zext(bits, bitsWithPaddingType), prefixBitsNum) or(bitsWithPadding, preservedBits) }<|endoftext|>
@param size the number of elements to take in each ${f.snapshotResult}, must be positive and can be greater than the number of elements in this ${f.collection}. """ } specialFor(Iterables, Sequences) { sample("samples.collections.Collections.Transformations.chunked") }
specialFor(CharSequences) { sample("samples.text.Strings.chunked") } specialFor(Iterables) { returns("List<List<T>>") } specialFor(Sequences) { returns("Sequence<List<T>>") } specialFor(CharSequences) { returns("List<String>") } sequenceClassification(intermediate, stateful)<|endoftext|>
|| function in functionsWhoseInitializerCallCanBeExtractedToCallSites // Extract calls to file initializers off of default accessors to simplify their inlining. || isDefaultAccessor if (function in rootSet || !initializerCallCouldBeDropped) result += function } return result }
val functionsRequiringGlobalInitializerCall = collectFunctionsRequiringInitializerCall( initializedFiles.beforeCallGlobal, callSitesRequiringGlobalInitializerCall.map { it.actualCallee } .intersect(callSitesNotRequiringGlobalInitializerCall.mapTo(mutableSetOf()) { it.actualCallee }) )<|endoftext|>
if (deprecation != null) { return deprecation } } return getDeprecation(propertyDescriptor) } override fun getGetterDeprecation(symbol: KtPropertySymbol): DeprecationInfo? { return getAccessorDeprecation(symbol, symbol.getter) { it.getter } }
override fun getSetterDeprecation(symbol: KtPropertySymbol): DeprecationInfo? { return getAccessorDeprecation(symbol, symbol.setter) { it.setter } } override fun getJavaGetterName(symbol: KtPropertySymbol): Name { val descriptor = getSymbolDescriptor(symbol) as? PropertyDescriptor<|endoftext|>
public inline fun <T, K> compareValuesBy(a: T, b: T, comparator: Comparator<in K>, selector: (T) -> K): Int { return comparator.compare(selector(a), selector(b)) } //// Not so useful without type inference for receiver of expression
//// compareValuesWith(v1, v2, compareBy { it.prop1 } thenByDescending { it.prop2 }) ///** // * Compares two values using the specified [comparator]. // */ //@Suppress("NOTHING_TO_INLINE")<|endoftext|>
* Generated from: [org.jetbrains.kotlin.fir.tree.generator.FirTreeBuilder.userTypeRef] */ abstract class FirUserTypeRef : FirTypeRefWithNullability() { abstract override val source: KtSourceElement? abstract override val annotations: List<FirAnnotation> abstract override val isMarkedNullable: Boolean
abstract val qualifier: List<FirQualifierPart> abstract val customRenderer: Boolean override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitUserTypeRef(this, data) @Suppress("UNCHECKED_CAST")<|endoftext|>
// SKIP_TXT open class BaseWithPrivate { private companion object { val X: Int = 1 val Y: Int = 1 } } open class Base { companion object { val X: String = "" } } class Derived : Base() { fun foo() { object : BaseWithPrivate() { fun bar() { X.length
<!INVISIBLE_REFERENCE!>Y<!>.hashCode() } } } }<|endoftext|>
val childrenResult = childrenBlocks[currentBlock]?.mapNotNull { dfs(it, variable) } ?: listOf() return when (childrenResult.size) { 0 -> return null 1 -> return childrenResult.single() else -> currentBlock } } return variables.associateWith { dfs(body, it) } }
private fun IrStatement.containsUsagesOf(variablesSet: Set<IrVariable>): Boolean { var used = false acceptVoid(object : IrElementVisitorVoid { override fun visitElement(element: IrElement) { if (!used) { element.acceptChildrenVoid(this) } }<|endoftext|>
"p${it.index}" to it.value.type.nativeType } val joinedCParameters = cFunctionParameters.joinToString { (name, type) -> "$type $name" } val cReturnType = returnType.nativeType val cFunctionHeader = when (platform) { KotlinPlatform.JVM -> { val funcFullName = buildString {
if (pkgName.isNotEmpty()) { append(pkgName) append('.') } append(jvmFileClassName) append('.') append(kotlinFunctionName) } val functionName = "Java_" + funcFullName.replace("_", "_1").replace('.', '_').replace("$", "_00024")<|endoftext|>
// because Java sourceCompatibility is fixed JVM target will different with JDK 11 on Gradle 8 // as the toolchain by default will use the Gradle JDK version gradleProperties.appendText( """ |kotlin.jvm.target.validation.mode=warning """.trimMargin() ) build("assemble") {
assertTasksExecuted(":kaptKotlin", ":kaptGenerateStubsKotlin") assertOutputContains("Javac options: {-source=1.8}") } } } @DisplayName("Works with JPMS on JDK 9+") @GradleTest fun testJpmsModule(gradleVersion: GradleVersion) {<|endoftext|>
actual fun intermediateFunctionWithActualization( commonActualization: MyCommonClassWithActualization, intermediateActualization: IntermediateClassWithActualization, common: MyCommonClass, intermediate: MyIntermediateClass, ) { } actual var intermediateVariableWithActualization: IntermediateClassWithActualization // FILE: jvmFile2.kt
@file:JvmName("MyFacadeKt") @file:JvmMultifileClass package mypack actual fun commonFunctionWithActualization( commonActualization: MyCommonClassWithActualization, intermediateActualization: IntermediateClassWithActualization, common: MyCommonClass, intermediate: MyIntermediateClass, ) { }<|endoftext|>
baz1LambdaVar\17:int=1:int
// library.kt:28 box: mainVar:int=1:int, fooParam\13:int=1:int, $i$f$foo\13\54:int=0:int, fooVar\13:int=1:int, bazParam\14:int=1:int, $i$f$baz\14\196:int=0:int, bazVar\14:int=3:int,<|endoftext|>
val k2: Unit = a.bar(1) val k3: Unit = a.bar("") val k4: Unit = a.bar(null) val k5: Int = b.foo() val k6: Unit = b.bar(1) val k7: Unit = b.bar("") val k8: Unit = b.bar(null)
val k9: Any = Java1.a val k10: Int = Java2.a val k11: Any = SeparateModuleJava1.a val k12: Int = SeparateModuleJava2.a val k13: Int = c.foo() val k14: Unit = c.bar(1) val k15: Unit = c.bar("")<|endoftext|>
// !LANGUAGE: +ContextReceivers // TARGET_BACKEND: JVM_IR class Result<T>(val x: T) context(Result<T>) val <T> result: Result<T> get() = this@Result fun <T> Result<T>.x(): T { with(result) { return x } } fun box(): String {
with(Result<String>("OK")) { return x() } }<|endoftext|>
} builder.append(" */\n") } deprecate?.let { deprecated -> val args = listOfNotNull( "\"${deprecated.message}\"", deprecated.replaceWith?.let { "ReplaceWith(\"$it\")" },
deprecated.level.let { if (it != DeprecationLevel.WARNING) "level = DeprecationLevel.$it" else null } ) builder.appendLine("@Deprecated(${args.joinToString(", ")})") val versionArgs = listOfNotNull( deprecated.warningSince?.let { "warningSince = \"$it\"" },<|endoftext|>
* Returns true if [containingFile] has a [KtImportDirective] whose imported FqName is the same as [classId] but references a different * symbol. */ private fun importDirectiveForDifferentSymbolWithSameNameIsPresent(classId: ClassId): Boolean {
val importDirectivesWithSameImportedFqName = containingFile.collectDescendantsOfType { importedDirective: KtImportDirective -> importedDirective.importedFqName?.shortName() == classId.shortClassName } return importDirectivesWithSameImportedFqName.isNotEmpty() &&<|endoftext|>
assertTrue(eqShortFloatQ(1.toShort(), 1.toFloat())) assertFalse(eqShortFloatQ(1.toShort(), null)) assertFalse(eqShortFloatQ(1.toShort(), undefined)) assertTrue(eqShortQFloat(0.toShort(), 0.toFloat())) assertFalse(eqShortQFloat(0.toShort(), 1.toFloat()))
assertFalse(eqShortQFloat(1.toShort(), 0.toFloat())) assertTrue(eqShortQFloat(1.toShort(), 1.toFloat())) assertFalse(eqShortQFloat(null, 0.toFloat())) assertFalse(eqShortQFloat(null, 1.toFloat())) assertFalse(eqShortQFloat(undefined, 0.toFloat()))<|endoftext|>
dependencies { testImplementation("$kotlinTestMultiplatformDependency") } """.trimIndent() ) checkTaskCompileClasspath("compileTestKotlin", checkModulesInClasspath = listOf("kotlin-test")) } } @JvmGradlePluginTests @DisplayName("coreLibrariesVersion override default version")
@GradleTest fun testCoreLibraryVersionsDsl(gradleVersion: GradleVersion) { project("simpleProject", gradleVersion) { removeDependencies(buildGradle) val customVersion = TestVersions.Kotlin.STABLE_RELEASE buildGradle.appendText( """ kotlin.coreLibrariesVersion = "$customVersion" dependencies {<|endoftext|>
function.origin == JvmLoweredDeclarationOrigin.STATIC_MULTI_FIELD_VALUE_CLASS_CONSTRUCTOR override fun isStatic(function: IrFunction): Boolean = function.origin == JvmLoweredDeclarationOrigin.STATIC_INLINE_CLASS_REPLACEMENT ||
function.origin == JvmLoweredDeclarationOrigin.STATIC_MULTI_FIELD_VALUE_CLASS_REPLACEMENT override fun IrBlockBuilder.argumentsForCall( expression: IrFunctionAccessExpression, stubFunction: IrFunction ): Map<IrValueParameter, IrExpression?> { val startOffset = expression.startOffset val endOffset = expression.endOffset<|endoftext|>
val snapshotFile = File(snapshotsDir.get().asFile, index.asSnapshotArchiveName) logger.debug("Packing $outputPath as $snapshotFile to make a backup") compressDirectoryToZip( snapshotFile, outputPath ) } else if (!outputPath.exists()) {
logger.debug("Ignoring $outputPath in making a backup as it does not exist") val markerFile = File(snapshotsDir.get().asFile, index.asNotExistsMarkerFile) markerFile.parentFile.mkdirs() markerFile.createNewFile() } else {<|endoftext|>
FirExpressionResolutionExtension.Factory { this.invoke(it) }.unaryPlus() } @JvmName("plusExtensionSessionComponent") operator fun ((FirSession) -> FirExtensionSessionComponent).unaryPlus() { FirExtensionSessionComponent.Factory { this.invoke(it) }.unaryPlus() }
@JvmName("plusSamConversionTransformerExtension") operator fun ((FirSession) -> FirSamConversionTransformerExtension).unaryPlus() { FirSamConversionTransformerExtension.Factory { this.invoke(it) }.unaryPlus() } @JvmName("plusAssignExpressionAltererExtension")<|endoftext|>
var arguments: List<IrTypeArgument> = emptyList() var annotations: List<IrConstructorCall> = emptyList() var abbreviation: IrTypeAbbreviation? = null var captureStatus: CaptureStatus? = null var capturedLowerType: IrType? = null var capturedTypeConstructor: IrCapturedType.Constructor? = null }
fun IrSimpleType.toBuilder(): IrSimpleTypeBuilder = IrSimpleTypeBuilder().also { b -> b.kotlinType = originalKotlinType if (this is IrCapturedType) { b.captureStatus = captureStatus b.capturedLowerType = lowerType b.capturedTypeConstructor = constructor } else { b.classifier = classifier }<|endoftext|>
ON_DEMAND(true, false, false, false, false), ONLY_REFERENCED(false, true, false, false, true), ALL(false, true, true, true, true), EXPLICITLY_EXPORTED(false, true, true, false, true), ONLY_DECLARATION_HEADERS(false, false, false, false, false),
WITH_INLINE_BODIES(false, false, false, false, true) }<|endoftext|>
kotlinBridgeBuilder.setReturnType(kotlinReturnType) cBridgeBuilder.setReturnType(cReturnType) } fun buildCSignature(name: String): String = cBridgeBuilder.buildSignature(name, stubs.language) fun buildKotlinBridge() = kotlinBridgeBuilder.build() }
internal class KotlinCallBuilder(private val irBuilder: IrBuilderWithScope, private val symbols: KonanSymbols) { val prepare = mutableListOf<IrStatement>() val arguments = mutableListOf<IrExpression>() val cleanup = mutableListOf<IrBuilderWithScope.() -> IrStatement>() private var memScope: IrVariable? = null<|endoftext|>
val superType = queue.removeFirst() val superTypeClassifier = superType.classifierOrNull?.owner ?: continue if (superTypeClassifier is IrTypeParameter) { queue.addAll(superTypeClassifier.superTypes) } else { return superType } } return context.irBuiltIns.anyNType }
private fun evaluateArguments(callSite: IrFunctionAccessExpression, callee: IrFunction): List<IrStatement> { val arguments = buildParameterToArgument(callSite, callee) val evaluationStatements = mutableListOf<IrVariable>() val evaluationStatementsFromDefault = mutableListOf<IrVariable>() val substitutor = ParameterSubstitutor()<|endoftext|>
// This file was generated automatically. See compiler/ir/ir.tree/tree-generator/ReadMe.md. // DO NOT MODIFY IT MANUALLY. package org.jetbrains.kotlin.ir.expressions import org.jetbrains.kotlin.ir.visitors.IrElementTransformer import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
/** * Generated from: [org.jetbrains.kotlin.ir.generator.IrTree.doWhileLoop] */ abstract class IrDoWhileLoop : IrLoop() { override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = visitor.visitDoWhileLoop(this, data)<|endoftext|>
assertStaticTypeIs<Array<in Number>>(c3) } @Test fun reduceIndexed() { expect(-1) { intArrayOf(1, 2, 3).reduceIndexed { index, a, b -> index + a - b } }
expect(-1.toLong()) { longArrayOf(1, 2, 3).reduceIndexed { index, a, b -> index + a - b } } expect(-1F) { floatArrayOf(1F, 2F, 3F).reduceIndexed { index, a, b -> index + a - b } }<|endoftext|>
"$functionDescriptor: Context receivers mismatch: $expectedContextReceiver != $actualContextReceiver" } } } val declaredValueParameters = declaration.valueParameters.drop(declaration.contextReceiverParametersCount).map { it.descriptor } val actualValueParameters = functionDescriptor.valueParameters
if (declaredValueParameters.size != actualValueParameters.size) { error("$functionDescriptor: Value parameters mismatch: $declaredValueParameters != $actualValueParameters") } else { declaredValueParameters.zip(actualValueParameters).forEach { (declaredValueParameter, actualValueParameter) -> require(declaredValueParameter == actualValueParameter) {<|endoftext|>
// !RENDER_DIAGNOSTICS_MESSAGES // !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE +UNUSED_VALUE @Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.LOCAL_VARIABLE) annotation class A @A
fun test() { @A var b: @A Int = 0 <!UNUSED_VALUE("15; var b: Int defined in test")!>b =<!> 15 }<|endoftext|>
val failedTasksSet: MutableSet<String> = ConcurrentHashMap.newKeySet() if (!binaryStateFile.exists()) return failedTasksSet try { ObjectInputStream(FileInputStream(binaryStateFile)).use { @Suppress("UNCHECKED_CAST") failedTasksSet.addAll(it.readObject() as Set<String>) }
} catch (e: Exception) { log.error("Cannot read test tasks state from $binaryStateFile", e) } return failedTasksSet } private fun writePreviouslyFailedTasks() { previouslyFailedTestTasks += testTaskSuppressedFailures.values.flatMap { taskErrors -> taskErrors.map { (taskPath, _) -> taskPath } }<|endoftext|>
package kotlin.js /** * Reinterprets this value as a value of the [dynamic type](/docs/reference/dynamic-type.html). */ @kotlin.internal.InlineOnly public inline fun Any?.asDynamic(): dynamic = this /** * Reinterprets this value as a value of the specified type [T] without any actual type checking. */
@kotlin.internal.InlineOnly public inline fun <T> Any?.unsafeCast(): @kotlin.internal.NoInfer T = this.asDynamic() /** * Reinterprets this `dynamic` value as a value of the specified type [T] without any actual type checking. */ @kotlin.internal.DynamicExtension @JsName("unsafeCastDynamic")<|endoftext|>
return "fail6: ${res.pong10}" } if (res.pong11 != "5::Z") { return "fail7: ${res.pong11}" } if (res.transform00 != 100) { return "fail8: ${res.transform00}" } if (res.transform11 != -125) {
return "fail9: ${res.transform11}" } if (res.Ping_ping00a != 9) { return "fail10: ${res.Ping_ping00a}" } if (res.Ping_ping00b != 100) { return "fail11: ${res.Ping_ping00b}" } if (res.Ping_ping11 != -64) {<|endoftext|>
val uInt = uIntValue.get() shr (position * 8) and 0xffu return uInt.toUByte() } } class ByteDelegateTest { val uInt = 0xA1B2C3u val uByte by ByteDelegate(0, this::uInt) fun test() { val actual = uByte
if (0xC3u.toUByte() != actual) throw AssertionError() } } fun box(): String { ByteDelegateTest().test() return "OK" }<|endoftext|>
0x0f20, 0x1040, 0x1090, 0x17e0,
0x1810, 0x1946, 0x19d0, 0x1a80, 0x1a90, 0x1b50, 0x1bb0, 0x1c40, 0x1c50, 0xa620, 0xa8d0, 0xa900, 0xa9d0, 0xa9f0, 0xaa50, 0xabf0, 0xff10, )<|endoftext|>
// Works in K2 for the same reasons as `a.baz(d)` // In K1, works by coincidence because we bind override groups for members from original and smart cast receiver, // and as return type from B is the same (not more specific), we choose the member from A as a group representative. // Thus, we have successful candidates // - A::foo // - B::foo returning String
// But A::foo is more specific, so we choose it a.foo(d).success } } } } class B : A() { override fun baz(a: Derived): M1Sub = TODO() public fun baz(a: Base): String = TODO()<|endoftext|>
package org.jetbrains.kotlin.abicmp.tasks import org.jetbrains.kotlin.abicmp.reports.SummaryReport import java.io.File import java.util.concurrent.Executors import java.util.concurrent.Future import java.util.jar.JarFile class DirTask( private val dir1: File,
private val dir2: File, private val id1: String?, private val id2: String?, private val header1: String, private val header2: String, private val reportDir: File, private val checkerConfiguration: CheckerConfiguration = checkerConfiguration {}, ) : Runnable { private val executor = Executors.newWorkStealingPool()<|endoftext|>
) = findLibraries(unresolvedLibraries, noStdLib, noDefaultLibs, noEndorsedLibs) .leaveDistinct() .omitDuplicateNames() /** * Returns the list of libraries based on [libraryNames], [noStdLib], [noDefaultLibs] and [noEndorsedLibs] criteria. *
* This method does not return any libraries that might be available via transitive dependencies * from the original library set (root set). */ private fun findLibraries( unresolvedLibraries: List<UnresolvedLibrary>, noStdLib: Boolean, noDefaultLibs: Boolean, noEndorsedLibs: Boolean, ): List<KotlinLibrary> {<|endoftext|>
irClass.declarations.add(context.buildBridge( startOffset = irClass.startOffset, endOffset = irClass.endOffset, overriddenFunction = overriddenFunction, targetSymbol = overriddenFunction.function.symbol, superQualifierSymbol = irClass.symbol) ) } }
internal class DECLARATION_ORIGIN_BRIDGE_METHOD(val bridgeTarget: IrFunction) : IrDeclarationOrigin { override val name: String get() = "BRIDGE_METHOD" override fun toString(): String { return "$name(target=${bridgeTarget.symbol})" } } internal val IrFunction.bridgeTarget: IrFunction?<|endoftext|>
// FILE: KotlinFile.kt fun foo(javaClass: JavaClass) { javaClass.<!DEPRECATION!>something1<!> javaClass.<!DEPRECATION!>something2<!> javaClass.something2 = 1 javaClass.<!DEPRECATION!>something2<!>++ javaClass.something3
javaClass.<!DEPRECATION!>something3<!> = 1 javaClass.<!DEPRECATION!>something3<!>++ javaClass.<!DEPRECATION!>something4<!> javaClass.<!DEPRECATION!>something4<!> = 1 javaClass.<!DEPRECATION, DEPRECATION!>something4<!>++<|endoftext|>
/** * Accumulates value starting with the last element and applying [operation] from right to left * to each element and current accumulator value. * * Throws an exception if this array is empty. If the array can be empty in an expected way, * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty. *
* @param [operation] function that takes an element and current accumulator value, * and calculates the next accumulator value. * * @sample samples.collections.Collections.Aggregates.reduceRight */ public inline fun IntArray.reduceRight(operation: (Int, acc: Int) -> Int): Int { var index = lastIndex<|endoftext|>
if (this === other) { return true } if (other !is BitSet) { return false } var index = 0 while (index < minOf(bits.size, other.bits.size)) { if (bits[index] != other.bits[index]) { return false } index++ }
val longestBits = if (bits.size > other.bits.size) bits else other.bits while (index < longestBits.size) { if (longestBits[index] != ALL_FALSE) { return false } index++ } return true } }<|endoftext|>