prompt
stringlengths
1
924
completion
stringlengths
14
937
} fun <T> foo(a: A<T>) { a.size = 42 as T } fun box(): String { val b = B() foo(b) if (b.size != 42) return "fail 1" val d = D() if (d.size != 117) return "fail 2" foo(d)
if (d.size != 42) return "fail 3" return "OK" }<|endoftext|>
private fun typeParametersMatch(psiFunction: KtCallableDeclaration, firFunction: FirCallableDeclaration): Boolean { if (firFunction.typeParameters.size != psiFunction.typeParameters.size) return false val boundsByName = psiFunction.typeConstraints.groupBy { it.subjectTypeParameterName?.getReferencedName() }
firFunction.typeParameters.zip(psiFunction.typeParameters) { expectedTypeParameter, candidateTypeParameter -> if (expectedTypeParameter.symbol.name.toString() != candidateTypeParameter.name) return false val candidateBounds = mutableListOf<KtTypeReference>() candidateBounds.addIfNotNull(candidateTypeParameter.extendsBound)<|endoftext|>
if (owner is KtNamedDeclaration) { if (owner.nameAsName == name) { add(owner.getSymbol()) } } if (owner is KtTypeParameterListOwner) { for (typeParameter in owner.typeParameters) { if (typeParameter.nameAsName == name) { add(typeParameter.getTypeParameterSymbol()) }
} } if (owner is KtCallableDeclaration) { for (typeParameter in owner.valueParameters) { if (typeParameter.nameAsName == name) { add(typeParameter.getParameterSymbol()) } } } if (owner is KtClassOrObject) {<|endoftext|>
@DisplayName("Build report is created") @GradleTestVersions( additionalVersions = [TestVersions.Gradle.G_7_6, TestVersions.Gradle.G_8_0], ) @GradleTest fun testBuildReportSmokeTest(gradleVersion: GradleVersion) { project("simpleProject", gradleVersion) { build("assemble") {
assertBuildReportPathIsPrinted() } build("clean", "assemble") { assertBuildReportPathIsPrinted() } } } @DisplayName("Build report output property accepts only certain values") @GradleTestVersions( additionalVersions = [TestVersions.Gradle.G_7_6, TestVersions.Gradle.G_8_0],<|endoftext|>
override fun generateSave(function: IrSimpleFunction) = addFunctionBody(function) { saveFunc -> fun irThis(): IrExpression = IrGetValueImpl(startOffset, endOffset, saveFunc.dispatchReceiverParameter!!.symbol) val encoderClass = compilerContext.getClassFromRuntime(SerialEntityNames.ENCODER_CLASS)
val descriptorGetterSymbol = irAnySerialDescProperty?.getter!!.symbol val encodeInline = encoderClass.functionByName(CallingConventions.encodeInline) val serialDescGetter = irGet(descriptorGetterSymbol.owner.returnType, irThis(), descriptorGetterSymbol) // val inlineEncoder = encoder.encodeInline()<|endoftext|>
assertTrue(deque.contains(3)) // remove, head < tail deque.remove(-1) assertTrue(deque.contains(5)) assertFalse(deque.contains(-1)) assertTrue(deque.contains(0)) } @Test
fun clear() = testArrayDeque { bufferSize: Int, _: Int, head: Int, tail: Int -> val deque = generateArrayDeque(head, tail, bufferSize).apply { clear() } assertTrue(deque.isEmpty()) } @Test fun removeElement() { val deque = ArrayDeque<Int>() deque.addLast(0)<|endoftext|>
// Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! // WITH_STDLIB // KT-34166: Translation of loop over literal completely removes the validation of step // DONT_TARGET_EXACT_BACKEND: JS import kotlin.test.* fun zero() = 0 fun box(): String { assertFailsWith<IllegalArgumentException> {
for (i in 7 downTo 1 step zero()) { } } assertFailsWith<IllegalArgumentException> { for (i in 7L downTo 1L step zero().toLong()) { } } assertFailsWith<IllegalArgumentException> { for (i in 'g' downTo 'a' step zero()) { } }<|endoftext|>
package test.properties.delegation.lazy import kotlin.test.* class LazyValTest { var result = 0 val a by lazy { ++result } @Test fun doTest() { a assertTrue(a == 1, "fail: initializer should be invoked only once") } } class UnsafeLazyValTest {
var result = 0 val a by lazy(LazyThreadSafetyMode.NONE) { ++result } @Test fun doTest() { a assertTrue(a == 1, "fail: initializer should be invoked only once") } } class NullableLazyValTest { var resultA = 0 var resultB = 0<|endoftext|>
build(":compileKotlin") { assertHasDiagnostic(KotlinToolingDiagnostics.InconsistentTargetCompatibilityForKotlinAndJavaTasks) } } } @JvmGradlePluginTests @DisplayName("Should do JVM target validation if java sources are added and configuration cache is reused") @GradleTest
internal fun shouldDoJvmTargetValidationOnNewJavaSourcesAndConfigurationCacheReuse(gradleVersion: GradleVersion) { project( projectName = "simple".fullProjectName, gradleVersion = gradleVersion, buildOptions = defaultBuildOptions.withConfigurationCache ) {<|endoftext|>
package org.jetbrains.kotlin.gradle.plugin.sources.android.configurator import org.jetbrains.kotlin.gradle.dsl.kotlinExtension import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet.Companion.COMMON_MAIN_SOURCE_SET_NAME import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet.Companion.COMMON_TEST_SOURCE_SET_NAME import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget<|endoftext|>
import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.resolve.fullyExpandedType import org.jetbrains.kotlin.fir.resolve.scope
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.resultType import org.jetbrains.kotlin.fir.scopes.CallableCopyTypeCalculator import org.jetbrains.kotlin.fir.scopes.getFunctions<|endoftext|>
get() = languageVersionSettings.supportsFeature(LanguageFeature.InferenceCompatibility) private val isTypeInferenceForSelfTypesSupported: Boolean get() = languageVersionSettings.supportsFeature(LanguageFeature.TypeInferenceOnCallsWithSelfTypes) private fun Context.getTypeVariableReadiness( variable: TypeConstructorMarker, dependencyProvider: TypeVariableDependencyInformationProvider,
): TypeVariableFixationReadiness = when { !notFixedTypeVariables.contains(variable) || dependencyProvider.isVariableRelatedToTopLevelType(variable) || variableHasUnprocessedConstraintsInForks(variable) -> TypeVariableFixationReadiness.FORBIDDEN isTypeInferenceForSelfTypesSupported && areAllProperConstraintsSelfTypeBased(variable) -><|endoftext|>
import org.jetbrains.kotlin.psi.stubs.elements.KtValueArgumentElementType class KotlinValueArgumentStubImpl<T : KtValueArgument>( parent: StubElement<out PsiElement>?, elementType: KtValueArgumentElementType<T>, private val isSpread: Boolean
) : KotlinPlaceHolderStubImpl<T>(parent, elementType), KotlinValueArgumentStub<T> { override fun isSpread(): Boolean = isSpread }<|endoftext|>
if (1.0 !in 1.0..<3.0 != !range0.contains(1.0)) throw AssertionError() if (!(1.0 in 1.0..<3.0) != !range0.contains(1.0)) throw AssertionError()
if (!(1.0 !in 1.0..<3.0) != range0.contains(1.0)) throw AssertionError() // no local optimizations if (element5 in 1.0..<3.0 != range0.contains(element5)) throw AssertionError()<|endoftext|>
override val diagnosticClass get() = DelegationSuperCallInEnumConstructor::class } interface ExplicitDelegationCallRequired : KtFirDiagnostic<PsiElement> { override val diagnosticClass get() = ExplicitDelegationCallRequired::class } interface SealedClassConstructorCall : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = SealedClassConstructorCall::class } interface DataClassConsistentCopyAndExposedCopyAreIncompatibleAnnotations : KtFirDiagnostic<KtAnnotationEntry> { override val diagnosticClass get() = DataClassConsistentCopyAndExposedCopyAreIncompatibleAnnotations::class }<|endoftext|>
open fun checkEqualsFunctionValueParameter(old: ProtoBuf.Function, new: ProtoBuf.Function): Boolean { if (old.valueParameterCount != new.valueParameterCount) return false for(i in 0..old.valueParameterCount - 1) { if (!checkEquals(old.getValueParameter(i), new.getValueParameter(i))) return false } return true
} open fun checkEqualsFunctionVersionRequirement(old: ProtoBuf.Function, new: ProtoBuf.Function): Boolean { if (old.versionRequirementCount != new.versionRequirementCount) return false for(i in 0..old.versionRequirementCount - 1) { if (old.getVersionRequirement(i) != new.getVersionRequirement(i)) return false<|endoftext|>
@Deprecated("Use 'Double.microseconds' extension property from Duration.Companion instead.", ReplaceWith("this.microseconds", "kotlin.time.Duration.Companion.microseconds")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "1.8", hiddenSince = "1.9")
public val Double.microseconds: Duration get() = toDuration(DurationUnit.MICROSECONDS) /** Returns a [Duration] equal to this [Int] number of milliseconds. */ @SinceKotlin("1.3") @ExperimentalTime<|endoftext|>
// TARGET_BACKEND: JVM // WITH_STDLIB object AX { @JvmStatic val c: String = "OK" @JvmStatic fun aStatic(): String { return AX.b() } fun aNonStatic(): String { return AX.b() } @JvmStatic fun b(): String { return "OK"
} fun getProperty(): String { return AX.c } } fun box() : String { if (AX.aStatic() != "OK") return "fail 1" if (AX.aNonStatic() != "OK") return "fail 2" if (AX.getProperty() != "OK") return "fail 3" return "OK" }<|endoftext|>
get() = (findProperty("nativeBuildType") as String?)?.let { NativeBuildType.valueOf(it) } ?: NativeBuildType.RELEASE internal val Project.crossTarget: String? get() = findProperty("crossTarget") as String? internal val Project.commonBenchmarkProperties: Map<String, Any> get() = mapOf(
"cpu" to System.getProperty("os.arch"), "os" to System.getProperty("os.name"), "jdkVersion" to System.getProperty("java.version"), "jdkVendor" to System.getProperty("java.vendor"), "kotlinVersion" to kotlinVersion )<|endoftext|>
if (test2 != "instMethodInt") return "Fail: c.instMethod(ints)==$test2" // Properties: // property accessors SHOULD NOT clash with class methods val test3 = c.rwProperty if (test3 != 123) return "Fail: c.rwProperty==$test3" val test3a = c.getRwProperty()
if (test3a != 111) return "Fail: c.getRwProperty()==$test3a" c.setRwProperty(444) val test3b = c.rwProperty if (test3b != 123) return "Fail: c.rwProperty==$test3b after c.setRwProperty(1234)" val test3c = c.getRwProperty()<|endoftext|>
fun testGSCmp(x: GSCmp<Any>) { if (x.sc.compareTo("OK") != 0) throw AssertionError() } fun testSCmp(x: SCmp) { if (x.sc.compareTo("OK") != 0) throw AssertionError() } fun testICmp(x: ICmp) {
if (x.intc.compareTo(42) != 0) throw AssertionError() } fun testGICmp(x: GICmp<Any>) { if (x.intc.compareTo(42) != 0) throw AssertionError() } fun testIICmp(x: IICmp) {<|endoftext|>
val wasmGcType: WasmSymbol<WasmTypeDeclaration> = context.referenceGcType(klassSymbol) val location = expression.getSourceLocation() if (klass.getWasmArrayAnnotation() != null) { require(expression.valueArgumentsCount == 1) { "@WasmArrayOf constructs must have exactly one argument" }
generateExpression(expression.getValueArgument(0)!!) body.buildInstr( WasmOp.ARRAY_NEW_DEFAULT, location, WasmImmediate.GcType(wasmGcType) ) body.commentPreviousInstr { "@WasmArrayOf ctor call: ${klass.fqNameWhenAvailable}" } return }<|endoftext|>
// !CHECK_TYPE // SKIP_JAVAC // FULL_JDK // WITH_EXTENDED_CHECKERS // FILE: a.kt import java.* import java.util.* import <!UNRESOLVED_IMPORT!>utils<!>.* import java.io.PrintStream
import <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Comparable<!> as Com val l : MutableList<in Int> = ArrayList<Int>() fun test(l : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util.List<Int><!>) {<|endoftext|>
import kotlin.native.Retain import direct.* // KT-54610 fun box(): String { callDirect() callRegular() return "OK" } @Retain //CHECK-LABEL: define i64 @"kfun:#callDirect(){}kotlin.ULong"() fun callDirect(): ULong { val cc = CallingConventions()
//CHECK: invoke i64 @_{{[a-zA-Z0-9]+}}_knbridge{{[0-9]+}}(i8* %{{[0-9]+}}, i64 42) return cc.direct(42uL) } @Retain //CHECK-LABEL: define i64 @"kfun:#callRegular(){}kotlin.ULong"()<|endoftext|>
<!DEBUG_INFO_CONSTANT_VALUE("1")!>val prop3 = a<!> // val prop4: 2 <!DEBUG_INFO_CONSTANT_VALUE("2")!>val prop4 = a + 1<!> fun foo() { // val prop5: 1
<!DEBUG_INFO_CONSTANT_VALUE("1")!>val prop5 = A().a<!> // val prop6: 2 <!DEBUG_INFO_CONSTANT_VALUE("2")!>val prop6 = A().a + 1<!> val b = { // val prop11: 1<|endoftext|>
isMarkedNullable: Boolean, override val constructor: TypeConstructor = createConstructor(originalTypeVariable) ) : AbstractStubType(originalTypeVariable, isMarkedNullable), StubTypeMarker { override fun materialize(newNullability: Boolean): AbstractStubType = StubTypeForTypeVariablesInSubtyping(originalTypeVariable, newNullability, constructor)
override fun toString(): String { return "Stub (subtyping): $originalTypeVariable${if (isMarkedNullable) "?" else ""}" } } // This type is used as a replacement of type variables for provideDelegate resolve class StubTypeForProvideDelegateReceiver( originalTypeVariable: NewTypeVariableConstructor, isMarkedNullable: Boolean,<|endoftext|>
@ImportantAnnotation @OtherAnnotation class Foo """.trimIndent() ) analyze(file) { val foo = file.getClassOrFail("Foo") val objCDocumentedAnnotations = foo.getObjCDocumentedAnnotations() if (objCDocumentedAnnotations.size != 1)
fail("Expected single documented annotation. Found: $objCDocumentedAnnotations") val objCDocumentedAnnotation = objCDocumentedAnnotations.single() assertEquals("ImportantAnnotation", objCDocumentedAnnotation.classId?.shortClassName?.asString()) } } @Test fun `test - special ObjC annotations are not documented for export`() {<|endoftext|>
fun typeHasCycle(ownedAnnotation: FirRegularClassSymbol, type: ConeKotlinType): Boolean { val referencedAnnotation = type.fullyExpandedType(session) .toRegularClassSymbol(session) ?.takeIf { it.classKind == ANNOTATION_CLASS } ?: return false if (!visitedAnnotations.add(referencedAnnotation)) {
return (referencedAnnotation in annotationsWithCycle).also { if (it) { annotationsWithCycle += ownedAnnotation } } } if (referencedAnnotation == targetAnnotation) { annotationsWithCycle += ownedAnnotation return true } if (referencedAnnotation.isJavaOrEnhancement) { return false<|endoftext|>
assertNotNull(statisticData) assertEquals(startTaskAction - startGradleTask, statisticData.getBuildTimesMetrics()[GradleBuildTime.GRADLE_TASK_PREPARATION]) assertEquals(1, statisticData.getBuildTimesMetrics()[GradleBuildTime.TASK_FINISH_LISTENER_NOTIFICATION]?.sign)
assertEquals(startWorker - callWorker, statisticData.getBuildTimesMetrics()[GradleBuildTime.RUN_WORKER_DELAY]) } private fun taskFinishEvent(startTime: Long = 1L, endTime: Long =10L) = object : TaskFinishEvent { override fun getEventTime(): Long = System.currentTimeMillis()<|endoftext|>
public inline fun kotlin.UByteArray.any(): kotlin.Boolean @kotlin.SinceKotlin(version = "1.3") @kotlin.ExperimentalUnsignedTypes @kotlin.internal.InlineOnly public inline fun kotlin.UByteArray.any(predicate: (kotlin.UByte) -> kotlin.Boolean): kotlin.Boolean
@kotlin.SinceKotlin(version = "1.3") @kotlin.ExperimentalUnsignedTypes @kotlin.internal.InlineOnly public inline fun kotlin.UIntArray.any(): kotlin.Boolean @kotlin.SinceKotlin(version = "1.3") @kotlin.ExperimentalUnsignedTypes<|endoftext|>
public actual fun minOf(a: Int, vararg other: Int): Int { var min = a for (e in other) min = minOf(min, e) return min } /** * Returns the smaller of the given values. */ @SinceKotlin("1.4") public actual fun minOf(a: Long, vararg other: Long): Long { var min = a
for (e in other) min = minOf(min, e) return min } /** * Returns the smaller of the given values. * * If any value is `NaN`, returns `NaN`. */ @SinceKotlin("1.4") public actual fun minOf(a: Float, vararg other: Float): Float { var min = a<|endoftext|>
val reference = statements.last() as IrFunctionReference reference.symbol.owner.origin = JvmLoweredDeclarationOrigin.INLINE_LAMBDA statements[statements.lastIndex] = reference.replaceOrigin(JvmLoweredStatementOrigin.INLINE_LAMBDA) } this is IrFunctionReference -> // ::function -> { args... -> function(args...) }
wrapFunction(symbol.owner).toLambda(this, scope!!) this is IrPropertyReference -> // References to generic synthetic Java properties aren't inlined in K1. Fixes KT-57103 if (typeArgumentsCount > 0 && symbol.owner.origin.let {<|endoftext|>
// WITH_STDLIB // WORKS_WHEN_VALUE_CLASS // LANGUAGE: +ValueClasses, +GenericInlineClassParameter OPTIONAL_JVM_INLINE_ANNOTATION value class R<T: Long>(private val r: T) { fun test() = run { ok() } private fun ok() = "OK" }
fun box() = R(0).test()<|endoftext|>
} else if (file.name.endsWith(".kt") || file.name.endsWith(".java")) { val nameWithoutVariant = file.name.genVariantMatchingName(optionalVariantSuffix) ?: continue // prefixed but with different variant if (nameWithoutVariant.startsWith(filePrefix)) {
val targetFile = File(toDir, nameWithoutVariant.substring(filePrefix.length)) if (nameWithoutVariant != file.name /* variant-prefixed file replaces the one without a variant prefix */ || !mapping.containsKey(targetFile) ) { FileUtil.copy(file, targetFile) mapping[targetFile] = file } }<|endoftext|>
package org.jetbrains.kotlin.incremental.components import org.jetbrains.kotlin.container.DefaultImplementation import java.io.File @DefaultImplementation(ExpectActualTracker.DoNothing::class) interface ExpectActualTracker { fun report(expectedFile: File, actualFile: File) object DoNothing : ExpectActualTracker {
override fun report(expectedFile: File, actualFile: File) { } } }<|endoftext|>
check(kClass.javaPrimitiveType, expected) } fun checkNull(clazz: Class<*>?) { assert (clazz == null) { "clazz should be null: ${clazz!!.canonicalName}" } } fun checkNull(kClass: KClass<*>) { checkNull(kClass.javaPrimitiveType) }
fun box(): String { check(Boolean::class.javaPrimitiveType, "boolean") check(Boolean::class, "boolean") check(Char::class.javaPrimitiveType, "char") check(Char::class, "char") check(Byte::class.javaPrimitiveType, "byte") check(Byte::class, "byte")<|endoftext|>
package org.jetbrains.kotlin.ir.util import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.symbols.impl.* import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid open class DeepCopySymbolRemapperPreservingSignatures : DeepCopySymbolRemapper() {
override fun visitClass(declaration: IrClass) { remapSymbol(classes, declaration) { symbol -> symbol.signature?.let { sig -> IrClassPublicSymbolImpl(sig) } ?: IrClassSymbolImpl() } declaration.acceptChildrenVoid(this) } override fun visitConstructor(declaration: IrConstructor) {<|endoftext|>
if (index < 0 && tag == "kotlin.untypedCharArrayF") { tag = "kotlin.charArrayF" index = source.indexOf(tag) } if (index < 0) return null // + 1 for closing quote var offset = index + tag.length + 1
while (offset < source.length && source[offset].isWhitespaceOrComma) { offset++ } val sourcePart = ShallowSubSequence(source, offset, source.length) val wrapFunctionMatcher = info.wrapFunctionRegex?.matcher(sourcePart) val isWrapped = wrapFunctionMatcher?.lookingAt() == true if (isWrapped) {<|endoftext|>
package org.jetbrains.kotlin.cli.jvm.index import com.intellij.openapi.vfs.VirtualFile import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import java.util.* interface JvmDependenciesIndex { val indexedRoots: Sequence<JavaRoot>
fun <T : Any> findClass( classId: ClassId, acceptedRootTypes: Set<JavaRoot.RootType> = JavaRoot.SourceAndBinary, findClassGivenDirectory: (VirtualFile, JavaRoot.RootType) -> T? ): T? fun traverseDirectoriesInPackage( packageFqName: FqName,<|endoftext|>
159083, 158933, 17707, 34033, 34035, 34070, 160714, 34148, 159532, 17757, 17761, 159665, 159954, 17771, 34384, 34396,
34407, 34409, 34473, 34440, 34574, 34530, 34681, 34600, 34667, 34694, 17879, 34785, 34817, 17913, 34912, 34915,<|endoftext|>
expect(listOf(1u)) { uintArrayOf(1u).take(1) } expect(listOf(2uL)) { ulongArrayOf(2u, 3u).take(1) } assertFails { ubyteArrayOf(1u).take(-1) } } @Test fun takeLast() {
expect(listOf()) { ubyteArrayOf().takeLast(1) } expect(listOf()) { ushortArrayOf(1u).takeLast(0) } expect(listOf(1u)) { uintArrayOf(1u).takeLast(1) } expect(listOf(3uL)) { ulongArrayOf(2u, 3u).takeLast(1) }<|endoftext|>
override var annotations: List<IrConstructorCall> by createLazyAnnotations() override var body: IrBody? by lazyVar(stubGenerator.lock) { if (tryLoadIr()) body else null } override var returnType: IrType by lazyVar(stubGenerator.lock) { if (tryLoadIr()) returnType else createReturnType() }
override val initialSignatureFunction: IrFunction? by createInitialSignatureFunction() override var dispatchReceiverParameter: IrValueParameter? by lazyVar(stubGenerator.lock) { if (tryLoadIr()) dispatchReceiverParameter else createReceiverParameter(descriptor.dispatchReceiverParameter, true) }<|endoftext|>
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(z) } fun test_6(list: List<Inv<Int>>, x: Inv<Int>, y: Inv<Number>, z: Inv<Any>) { list.contains1(x)
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(y) list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(z) }<|endoftext|>
false as java.lang.Boolean, '\n' as java.lang.Character, Byte.MIN_VALUE as java.lang.Byte, Short.MIN_VALUE as java.lang.Short, Int.MIN_VALUE as java.lang.Integer, Float.POSITIVE_INFINITY as java.lang.Float,
java.lang.Long(Long.MAX_VALUE), java.lang.Double(Double.NEGATIVE_INFINITY), null, null, null, null, null, null, null, null ) first.writeToParcel(parcel, 0) second.writeToParcel(parcel, 0) val bytes = parcel.marshall()<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & ClassLevel5")!>e<!>.test1() <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & ClassLevel5")!>e<!>.test2()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & ClassLevel5")!>e<!>.test3() <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & ClassLevel5")!>e<!>.test4()<|endoftext|>
val internalNpmDependencies = internalDependencies .map { val compilationNpmResolution: KotlinCompilationNpmResolution = rootResolver[it.projectPath][it.compilationName] compilationNpmResolution.getResolutionOrPrepare( npmResolutionManager, logger ) }
.flatMap { it.externalNpmDependencies } val importedExternalGradleDependencies = externalGradleDependencies.mapNotNull { npmResolutionManager.parameters.gradleNodeModulesProvider.get().get(it.dependencyName, it.dependencyVersion, it.file) } + fileCollectionDependencies.flatMap { dependency -> dependency.files<|endoftext|>
val property = correspondingPropertySymbol!!.owner if (property.isOverriddenExported(context)) { return isOverriddenExported(context) } return overridesExternal() || property.getJsName() != null } fun IrSimpleFunction.isAccessorOfOverriddenStableProperty(context: JsIrBackendContext): Boolean {
return overriddenStableProperty(context) || correspondingPropertySymbol!!.owner.overridesExternal() } private fun IrOverridableDeclaration<*>.overridesExternal(): Boolean { if (this.isEffectivelyExternal()) return true return overriddenSymbols.any { (it.owner as IrOverridableDeclaration<*>).overridesExternal() } }<|endoftext|>
is FirSimpleFunction -> { when { annotated.isLocal -> TargetLists.T_LOCAL_FUNCTION annotated.isMember -> TargetLists.T_MEMBER_FUNCTION else -> TargetLists.T_TOP_LEVEL_FUNCTION } } is FirTypeAlias -> TargetLists.T_TYPEALIAS
is FirPropertyAccessor -> if (annotated.isGetter) TargetLists.T_PROPERTY_GETTER else TargetLists.T_PROPERTY_SETTER is FirBackingField -> TargetLists.T_BACKING_FIELD is FirFile -> TargetLists.T_FILE is FirTypeParameter -> TargetLists.T_TYPE_PARAMETER<|endoftext|>
class TestMultipleIdenticalTypeParameters<T1, T2> { @Deprecated(message = "", level = DeprecationLevel.HIDDEN) <!CONFLICTING_OVERLOADS!>constructor()<!> } <!CONFLICTING_OVERLOADS!>fun <T1, T2> TestMultipleIdenticalTypeParameters()<!> {}
class TestMultipleIdenticalTypeParametersReverse<T1, T2> { <!CONFLICTING_OVERLOADS!>constructor()<!> } <!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T1, T2> TestMultipleIdenticalTypeParametersReverse()<!> {}<|endoftext|>
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression import org.jetbrains.kotlin.utils.SmartList internal class BranchingExpressionGenerator(statementGenerator: StatementGenerator) : StatementGeneratorExtension(statementGenerator) { fun generateIfExpression(expression: KtIfExpression): IrExpression {
var ktLastIf: KtIfExpression = expression val irBranches = SmartList<IrBranch>() var irElseBranch: IrExpression? = null whenBranches@ while (true) { val irCondition = ktLastIf.condition!!.genExpr()<|endoftext|>
description = "Treat bytecode from all files as one in ${BytecodeTextHandler::class}" ) val NO_CHECK_LAMBDA_INLINING by directive( description = "Skip checking of lambda inlining in ${BytecodeInliningHandler::class.java}" ) val SKIP_INLINE_CHECK_IN by stringDirective(
description = "Skip checking of specific methods in ${BytecodeInliningHandler::class.java}" ) val DUMP_SMAP by directive( description = """Enables ${SMAPDumpHandler::class}""" ) val NO_SMAP_DUMP by directive( description = "Don't dump smap for marked file", applicability = File )<|endoftext|>
get() = asIr().isCompanion override val RegularClassSymbolMarker.isInner: Boolean get() = asIr().isInner override val RegularClassSymbolMarker.isInline: Boolean get() = asIr().isValue override val RegularClassSymbolMarker.isValue: Boolean get() = asIr().isValue
override val RegularClassSymbolMarker.isFun: Boolean get() = asIr().isFun override val ClassLikeSymbolMarker.typeParameters: List<TypeParameterSymbolMarker> get() { val parameters = processIr( onClass = { it.typeParameters }, onTypeAlias = { it.typeParameters }, )<|endoftext|>
delegateVariableForPropertyCache[symbol] = irProperty.delegate.symbol getterForPropertyCache[symbol] = irProperty.getter.symbol irProperty.setter?.let { setterForPropertyCache[symbol] = it.symbol } localStorage.putDelegatedProperty(property, symbol) return irProperty }
private fun createLocalDelegatedPropertySymbols(property: FirProperty): LocalDelegatedPropertySymbols { val propertySymbol = IrLocalDelegatedPropertySymbolImpl() val getterSymbol = createFunctionSymbol(signature = null) val setterSymbol = runIf(property.isVar) { createFunctionSymbol(signature = null) }<|endoftext|>
// WITH_STDLIB // FULL_JDK @file:JvmName("TestKt") package test import kotlinx.parcelize.* import android.os.Parcel import android.os.Parcelable import java.util.* import kotlinx.collections.immutable.* @Parcelize data class Test( val a: List<String>,
val b: MutableList<String>, val c: ArrayList<String>, val d: LinkedList<String>, val e: Set<String>, val f: MutableSet<String>, val g: TreeSet<String>, val h: HashSet<String>, val i: LinkedHashSet<String>, val j: NavigableSet<String>,<|endoftext|>
set(myName: Int) {} fun checkPropertySetterParam(property: KMutableProperty<*>, name: String?) { val parameter = property.setter.parameters.single() assertEquals(0, parameter.index) assertEquals(name, parameter.name) } fun box(): String { checkPropertySetterParam(::default, null)
checkPropertySetterParam(::defaultAnnotated, null) checkPropertySetterParam(::custom, "myName") return "OK" }<|endoftext|>
override fun additionalCheck(member: FirCallableSymbol<*>): Boolean? { if (member.origin == FirDeclarationOrigin.Synthetic.FakeHiddenInPreparationForNewJdk) return true if (!member.isJavaOrEnhancement) return false
val containingClassName = member.containingClassLookupTag()?.classId?.asSingleFqName()?.toUnsafe() ?: return false // If the super class is mapped to a Kotlin built-in class, then we don't require `override` keyword. if (JavaToKotlinClassMap.mapKotlinToJava(containingClassName) != null) { return true }<|endoftext|>
// Otherwise, i.e., if we won't skip type with no type arguments, flag overriding might bother a case like: // @JvmSuppressWildcards(false) Long -> java.lang.Long, not long, even though it should be no-op! if (type.fe10Type.arguments.isEmpty()) typeMappingMode else
typeMappingMode.updateArgumentModeFromAnnotations( type.fe10Type, typeMapper.typeContext, suppressWildcards, ) } } private fun simplifyType(type: UnwrappedType): KotlinType { var result = type do { val oldResult = result result = when (type) {<|endoftext|>
* Let S,C and T denote the sin, cos and tan respectively on * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 * in [-pi/4 , +pi/4], and let n = k mod 4. * We have * * n sin(x) cos(x) tan(x)
* ---------------------------------------------------------- * 0 S C T * 1 C -S -1/T * 2 -S -C T * 3 -C S -1/T * ---------------------------------------------------------- * * Special cases: * Let trig be any of sin, cos, or tan.<|endoftext|>
// TESTCASE NUMBER: 1 fun case_1() { var value_1: Int val l = { value_1 = 10 } funWithAtLeastOnceCallsInPlace(l) <!UNINITIALIZED_VARIABLE!>value_1<!>.inc() } // TESTCASE NUMBER: 2 fun case_2() {
var value_1: Int val l = fun () { value_1 = 10 } funWithAtLeastOnceCallsInPlace(l) <!UNINITIALIZED_VARIABLE!>value_1<!>.inc() } // TESTCASE NUMBER: 3 fun case_3() { var value_1: Int<|endoftext|>
package org.jetbrains.kotlin.gradle.targets.js.npm import org.junit.Test import java.io.File import kotlin.test.assertNotNull class GradleNodeModuleBuilderTest { // Gson (used in fromSrcPackageJson) deserialize json to PackageJson no matter on nullability and default values
// Check that in case where there is no dependencies fields, we don't get nullable fields, that declared as non-nullable @Test fun validPackageJsonWithoutDependencies() { val packageJson = fromSrcPackageJson(<|endoftext|>
Regex("[^\\s\\d]{$quantifierMatchCount,$compositeMax}").let { compositeRegex -> testMatches(compositeRegex, input, inputDescription) } Regex("[^\\s\\d]{${quantifierMatchCount + 1},$compositeMax}").let { compositeRegex ->
testMatches(compositeRegex, input, inputDescription, expected = false) } } @Test fun fixedLengthQualifierReluctant() { val plusRegex = Regex(".+?") testMatches(plusRegex, input, inputDescription) val starRegex = Regex(".*?")<|endoftext|>
// TESTCASE NUMBER: 4 fun case_4(value_1: Boolean?): Boolean { contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns(true) implies (value_1 != null && !value_1)<!> } return value_1 != null && !value_1 } // TESTCASE NUMBER: 5
fun Boolean.case_5(value_1: Any?): Boolean? { contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returnsNotNull() implies (value_1 is Boolean? && value_1 != null && value_1)<!> } return if (value_1 is Boolean? && value_1 != null && value_1) true else null }<|endoftext|>
if (!(element23 !in intArray.indices) != range0.contains(element23)) throw AssertionError() } fun testR1xE0() { // with possible local optimizations if ((-1).toByte() in objectArray.indices != range1.contains((-1).toByte())) throw AssertionError()
if ((-1).toByte() !in objectArray.indices != !range1.contains((-1).toByte())) throw AssertionError() if (!((-1).toByte() in objectArray.indices) != !range1.contains((-1).toByte())) throw AssertionError()<|endoftext|>
* Returns the sum of all elements in the array. */ @kotlin.jvm.JvmName("sumOfShort") public fun Array<out Short>.sum(): Int { var sum: Int = 0 for (element in this) { sum += element } return sum } /** * Returns the sum of all elements in the array. */
@kotlin.jvm.JvmName("sumOfInt") public fun Array<out Int>.sum(): Int { var sum: Int = 0 for (element in this) { sum += element } return sum } /** * Returns the sum of all elements in the array. */ @kotlin.jvm.JvmName("sumOfLong")<|endoftext|>
newParamList[0].defaultValue = with(context.createJvmIrBuilder(fakeFunction.symbol)) { withinScope(fakeFunction) { fakeFunction.body = irExprBody(irBlock { val mfvcNodeInstance = structure.rootMfvcNode.createInstanceFromValueDeclarationsAndBoxType( param.type as IrSimpleType, newParamList )
flattenExpressionTo(defaultValue, mfvcNodeInstance) +irGet(newParamList[0]) }) postActionAfterTransformingClassDeclaration(fakeFunction) fakeFunction.body?.patchDeclarationParents(replacement) as IrExpressionBody } } } } } override fun visitParameter(parameter: IrValueParameter) {<|endoftext|>
task.input.forEach { task.dependsOn(it.name) } val file = extension.project.file(output) file.parentFile.mkdirs() task.output = file task.cmd = tool.first() task.args = listOf(*tool.drop(1).toTypedArray(), *args.toTypedArray()) } }
open class SourceSet( val sourceSets: SourceSets, val name: String, val initialDirectory: File = sourceSets.project.projectDir, val initialSourceSet: SourceSet? = null, val rule: Pair<String, String>? = null ) { var collection = sourceSets.project.objects.fileCollection() as FileCollection fun file(path: String) {<|endoftext|>
override fun printNonTestOutput(text: String, type: LogType?) { val value = text.trimEnd() progressLogger.progress(value) parseConsole(value, type) } private fun parseConsole(text: String, type: LogType?) { var actualType = type
val inStackTrace = stackTraceProcessor.process(text) { line, logType -> log.processLogMessage(line, logType) } if (inStackTrace) return val launcherMessage = KARMA_MESSAGE.matchEntire(text) val actualText = if (launcherMessage != null) {<|endoftext|>
expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: ${adjustNoClassFoundForLazyIr("/RemovedClass")}")) { getAnnotationClassWithClassReferenceParameterThatDisappears2Inline() }
expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithClassReferenceParameterThatDisappears2AsAny() }<|endoftext|>
x = 'b' Unit } foo() return x == 'b' } fun t8() : Boolean { var x = 20.toShort() val foo = { val bar = { x = 30.toShort() Unit } bar() Unit } foo() return x == 30.toShort() }
fun t9(x0: Int) : Boolean { var x = x0 while(x < 100) { x++ } return x == 100 } fun t10() : Boolean { var y = 1 val foo = { val bar = { y = y + 1 } bar() } foo() return y == 2 }<|endoftext|>
PrimitiveType.INT -> IntValue((this.value as Number).toInt()) PrimitiveType.FLOAT -> FloatValue((this.value as Number).toFloat()) PrimitiveType.LONG -> LongValue((this.value as Number).toLong()) PrimitiveType.DOUBLE -> DoubleValue((this.value as Number).toDouble()) null -> when (constType.getUnsignedType()) {
UnsignedType.UBYTE -> UByteValue((this.value as Number).toByte()) UnsignedType.USHORT -> UShortValue((this.value as Number).toShort()) UnsignedType.UINT -> UIntValue((this.value as Number).toInt()) UnsignedType.ULONG -> ULongValue((this.value as Number).toLong()) null -> when {<|endoftext|>
if (sourceInTargets > 0) return value * sourceInTargets val otherInThis = sourceUnit.timeUnit.convert(1, targetUnit.timeUnit) return value / otherInThis } @SinceKotlin("1.5") internal actual fun convertDurationUnitOverflow(value: Long, sourceUnit: DurationUnit, targetUnit: DurationUnit): Long {
return targetUnit.timeUnit.convert(value, sourceUnit.timeUnit) } @SinceKotlin("1.5") internal actual fun convertDurationUnit(value: Long, sourceUnit: DurationUnit, targetUnit: DurationUnit): Long { return targetUnit.timeUnit.convert(value, sourceUnit.timeUnit) }<|endoftext|>
// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION class A { class B { class A { <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
fun get(a: String): Any?<!> = null <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter fun take(a: Number): String?<!> = null<|endoftext|>
"preferably optimized for standard JVMs, and its dependencies declared externally, " ) } assertNotNull(attributeMatchingString, "Expected variant mismatch string is not found") assertTrue(attributeMatchingString.contains("attribute 'com.example.compilation' with value 'bar'"))
assertTrue(attributeMatchingString.contains("attribute 'com.example.target' with value 'foo'")) assertTrue(attributeMatchingString.contains("attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'")) } } } } } @DisplayName("Load compiler-embeddable after other plugin artifacts")<|endoftext|>
// K is fixed into CapturedType(out NotFixed: TypeVariable(R) capture(id(<!TYPE_MISMATCH, TYPE_MISMATCH!>getOut()<!>)) // unexpected TYPE_MISMATCH (KT-63996) // capture(getOut()) // OK!!! Unit } build<String> { emit("")
// K is fixed into CapturedType(out NotFixed: TypeVariable(R) capture(id(getOut())) // OK!!! // capture(getOut()) // OK!!! Unit } }<|endoftext|>
val lv = 3L if (2L.javaClass != lv.javaClass) return "fail 2" if (2L.javaClass != l.javaClass) return "fail 3" val dv = 3.0 if (2.0.javaClass != dv.javaClass) return "fail 4"
if (2.0.javaClass != d.javaClass) return "fail 5" val iv = 3 if (2.javaClass != iv.javaClass) return "fail 6" if (2.javaClass != i.javaClass) return "fail 7" return result }<|endoftext|>
public inline fun ImageBitmapOptions(imageOrientation: ImageOrientation? = ImageOrientation.NONE, premultiplyAlpha: PremultiplyAlpha? = PremultiplyAlpha.DEFAULT, colorSpaceConversion: ColorSpaceConversion? = ColorSpaceConversion.DEFAULT, resizeWidth: Int? = undefined, resizeHeight: Int? = undefined, resizeQuality: ResizeQuality? = ResizeQuality.LOW):
ImageBitmapOptions {<|endoftext|>
val offset = if (param.isSkipped) -1 else nextParamOffset.also { nextParamOffset += param.type.size } val info = param.fieldEquivalent?.also { // Permit to access this capture through a field within the constructor itself, but remap to local loads. constructorInlineBuilder.addCapturedParam(it, it.newFieldName).remapValue =
if (offset == -1) null else StackValue.local(offset, param.type) } ?: param if (!param.isSkipped && info is CapturedParamInfo && !info.isSkipInConstructor) { val desc = info.type.descriptor<|endoftext|>
compilerId, clientMarkerFile, actualJvmOptions, daemonOptions, DaemonReportingTargets(messages = daemonMessagesCollector, out = System.err), autostart = true, leaseSession = true, sessionAliveFlagFile = sessionMarkerFile,
)?.also { compileServices.add(it.compileService) } ?: error("failed to connect daemon") } } fun File.assertLogFileContains(vararg substrings: String) { val text = readText() val notFound = substrings.filterNot { it in text } assert(notFound.isEmpty()) { """<|endoftext|>
<!DEBUG_INFO_CALL("fqName: kotlin.text.Regex.<init>; typeCall: function")!>Regex("")<!> } // FILE: Lib2.kt package libCase2 //fun Regex(pattern: String) {} object Regex { operator fun invoke(s: String) {} } // FILE: Lib11.kt
package lib1Case2 enum class Regex{ ; companion object { operator fun invoke(s: String) {} } } // FILE: TestCase3.kt /* * TESTCASE NUMBER: 3 * UNEXPECTED BEHAVIOUR * ISSUES: KT-39073 */ package testPackCase3 import libCase3.*<|endoftext|>
expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithDefaultRemovedEnumEntryParameterInline() }
expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithDefaultRemovedEnumEntryParameterAsAny() }<|endoftext|>
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.declarations.FirTypeParameter import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRef import org.jetbrains.kotlin.fir.declarations.FirValueParameter
import org.jetbrains.kotlin.fir.declarations.utils.correspondingValueParameterFromPrimaryConstructor import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.resolve.providers.firProvider<|endoftext|>
* After the completion ends and all the variables are fixed, this member candidate still contains them, so what this function does * is replace the candidate from Delegate<Tv, ...> scope to the same candidate from Delegate<ResultTypeForT, ..>. * * The fun fact is that it wasn't necessary before Delegate Inference refactoring because there were stub types left and FIR2IR
* handled them properly as equal-to-anything unlike the type variable types. * * See codegen/box/delegatedProperty/noTypeVariablesLeft.kt * * That all looks a bit ugly, but there are not many options. * In an ideal world, we wouldn't have substitution overrides in FIR, but instead used a pair original symbol and substitution<|endoftext|>
} } is KtTryExpression -> { val tryKeyword = node.tryKeyword if ( node.tryBlock.textRange.contains(reportOn.textRange) && tryKeyword != null ) { context.trace.report( ComposeErrors.ILLEGAL_TRY_CATCH_AROUND_COMPOSABLE.on(tryKeyword)
) } } is KtFunction -> { val descriptor = bindingContext[BindingContext.FUNCTION, node] if (descriptor == null) { illegalCall(context, reportOn) return } val composable = descriptor.isComposableCallable(bindingContext) if (!composable) {<|endoftext|>
@file:Suppress("KDocUnresolvedReference") package org.jetbrains.kotlin.konan.test.blackbox.support import org.jetbrains.kotlin.konan.test.blackbox.support.TestCase.WithTestRunnerExtras
import org.jetbrains.kotlin.konan.test.blackbox.support.TestModule.Companion.allDependencies import org.jetbrains.kotlin.konan.test.blackbox.support.TestModule.Companion.allDependsOn import org.jetbrains.kotlin.konan.test.blackbox.support.runner.TestRunCheck<|endoftext|>
try { block() } finally { // TODO: it is possible to implement chaining without recursion, // but it would require using an anonymous object here // which is not yet supported in Kotlin Native inliner. currentTop?.invoke() } } } } @ExperimentalForeignApi
public abstract class AutofreeScope : DeferScope(), NativePlacement { abstract override fun alloc(size: Long, align: Int): NativePointed } @ExperimentalForeignApi public open class ArenaBase(private val parent: NativeFreeablePlacement = nativeHeap) : AutofreeScope() { private var lastChunk: NativePointed? = null<|endoftext|>
public inline fun inlineFun(): String {
return <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<!>.classFun() + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<ModuleConfiguratorWithTests><!>.getConfiguratorSettings() +<|endoftext|>
private fun setAccessorTypesByPropertyType(property: FirProperty) { property.getter?.replaceReturnTypeRef(property.returnTypeRef) property.setter?.valueParameters?.map { it.replaceReturnTypeRef(property.returnTypeRef) } } override fun transformField(field: FirField, data: Any?): FirField = whileAnalysing(session, field) {
withScopeCleanup { field.transformReturnTypeRef(this, data).transformAnnotations(this, data) field } } override fun transformBackingField(backingField: FirBackingField, data: Any?): FirStatement = whileAnalysing(session, backingField) { backingField.transformAnnotations(this, data)<|endoftext|>
override fun visitReturn(expression: IrReturn): IrExpression { expression.transformChildrenVoid(this) return performHighLevelJump( targetScopePredicate = { it is ReturnableScope && it.symbol == expression.returnTargetSymbol }, jump = Return(expression.returnTargetSymbol), startOffset = expression.startOffset, endOffset = expression.endOffset,
value = expression.value ) ?: expression } private fun performHighLevelJump(targetScopePredicate: (Scope) -> Boolean, jump: HighLevelJump, startOffset: Int, endOffset: Int, value: IrExpression ): IrExpression? { val tryScopes = otherScopeStack.reversed()<|endoftext|>
/** Adds the given [elements] to the collection corresponding to the given [key]. */ fun append(key: KEY, elements: Collection<E>) /** Adds the given [element] to the collection corresponding to the given [key]. */ fun append(key: KEY, element: E) { append(key, listOf(element)) } } /**
* [PersistentStorage] that delegates operations to another [storage]. * * THREAD SAFETY: All [PersistentStorage]s (both parent classes and their subclasses) need to be thread-safe. This requirement seems to come * from JPS -- see commit 275a02c; Gradle builds don't have this requirement. To ensure thread safety, currently all non-private<|endoftext|>
override val source: SourceElement get() = descriptor.source override var metadata: MetadataSource? get() = null set(_) = error("We should never need to store metadata of external declarations.") private var irLoaded: Boolean? = null override fun loadIr(): Boolean { assert(parent is IrPackageFragment) return irLoaded
?: stubGenerator.extensions.deserializeClass(this, stubGenerator, parent).also { irLoaded = it } } }<|endoftext|>
const val equalsInt1 = intOneVal.<!EVALUATED("false")!>equals(intTwoVal)<!> const val equalsInt2 = intTwoVal.<!EVALUATED("true")!>equals(intTwoVal)<!> const val equalsInt3 = <!EVALUATED("false")!>intThreeVal == intTwoVal<!>
const val equalsInt4 = intFourVal.<!EVALUATED("false")!>equals(1)<!> const val equalsLong1 = longOneVal.<!EVALUATED("false")!>equals(longTwoVal)<!> const val equalsLong2 = longTwoVal.<!EVALUATED("true")!>equals(longTwoVal)<!><|endoftext|>
val expression = dispatchReceiver?.unwrapSmartcastExpression() return (expression as? FirThisReceiverExpression)?.calleeReference?.boundSymbol == receiver || (expression as? FirResolvedQualifier)?.symbol == receiver } fun CFGNode<*>.reportErrorsOnInitializationsInInputs(symbol: FirPropertySymbol, path: EdgeLabel) {
for (previousNode in previousCfgNodes) { if (edgeFrom(previousNode).kind.isBack) continue when (val assignmentNode = getValue(previousNode)[path]?.get(symbol)?.location) { is VariableDeclarationNode -> {} // unreachable - `val`s with initializers do not require hindsight is VariableAssignmentNode -><|endoftext|>
for (file in changedFiles) { val extension = file.extension when { extension.equals("class", ignoreCase = true) -> { classFiles.add(file) } extension.equals("jar", ignoreCase = true) -> { jarFiles.add(file) } extension.equals("klib", ignoreCase = true) -> {
// TODO: shouldn't jars and klibs be tracked separately? // TODO: what to do with `in-directory` klib? jarFiles.add(file) } } } for (jar in jarFiles) { val historyEither = getBuildHistoryFilesForJar(jar) when (historyEither) {<|endoftext|>
public fun kotlin.ByteArray.slice(indices: kotlin.collections.Iterable<kotlin.Int>): kotlin.collections.List<kotlin.Byte> public fun kotlin.ByteArray.slice(indices: kotlin.ranges.IntRange): kotlin.collections.List<kotlin.Byte>
public fun kotlin.CharArray.slice(indices: kotlin.collections.Iterable<kotlin.Int>): kotlin.collections.List<kotlin.Char> public fun kotlin.CharArray.slice(indices: kotlin.ranges.IntRange): kotlin.collections.List<kotlin.Char><|endoftext|>
fun box(): String { val inline = Inline() assertEquals(1, doNothing1(inline, 1)) assertEquals(2, doNothing1(inline, 2)) assertEquals(3, doNothing2(inline, 3)) assertEquals(4, doNothing2(inline, 4)) assertEquals(11, doNothing3(inline)) return "OK"
}<|endoftext|>
assertEquals(a - b * fd, mod) } catch (e: AssertionError) { fail("a: $a, b: $b, div: $div, rem: $rem, floorDiv: $fd, mod: $mod", e) } } check(10, -3, -4, -2) check(10, 3, 3, 1)
check(-10, 3, -4, 2) check(-10, -3, 3, -1) check(-2, 2, -1, -0) val values = listOf(1, -1, 2, -2, 3, -3, Long.MIN_VALUE, Long.MAX_VALUE) for (a in values + 0) { for (b in values) {<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<*, Inv<out kotlin.Comparable<*> & java.io.Serializable>>")!>select(id { x: Int -> Inv(10) }, { x: String -> Inv("") })<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function<kotlin.Any>")!>select({ x: Int -> TODO() }, id { x: Int, y: Number -> Any() })<!><|endoftext|>
contract { callsInPlace(builderAction, InvocationKind.EXACTLY_ONCE) } return buildMapInternal(builderAction) } @PublishedApi @SinceKotlin("1.3") @kotlin.internal.InlineOnly internal expect inline fun <K, V> buildMapInternal(builderAction: MutableMap<K, V>.() -> Unit): Map<K, V>
/** * Builds a new read-only [Map] by populating a [MutableMap] using the given [builderAction] * and returning a read-only map with the same key-value pairs. * * The map passed as a receiver to the [builderAction] is valid only inside that function. * Using it outside of the function produces an unspecified behavior. *<|endoftext|>
fun setValue(v: Long) { value = v } setValue(v) return value } fun testFloat(v: Float): Float { var value = 0.toFloat() fun setValue(v: Float) { value = v } setValue(v) return value } fun testDouble(v: Double): Double {
var value = 0.toDouble() fun setValue(v: Double) { value = v } setValue(v) return value } fun box(): String { return when { testBoolean(true) != true -> "testBoolean" testChar('a') != 'a' -> "testChar"<|endoftext|>
testServices.assertions.assertEqualsToTestDataFileSibling(scopeContextStringRepresentationPretty, extension = ".pretty.txt") } } private fun KtAnalysisSession.render( importingScope: KtScopeContext, renderDefaultImportingScope: Boolean, printPretty: Boolean = false, ): String = prettyPrint {
renderForTests(analysisSession, importingScope, this@prettyPrint, printPretty) { ktScopeKind -> when (ktScopeKind) { is KtScopeKind.PackageMemberScope -> false is KtScopeKind.DefaultSimpleImportingScope -> renderDefaultImportingScope is KtScopeKind.DefaultStarImportingScope -> renderDefaultImportingScope else -> true } }<|endoftext|>