prompt
stringlengths
1
924
completion
stringlengths
14
937
// This file was generated automatically. See native/swift/sir/tree-generator/Readme.md. // DO NOT MODIFY IT MANUALLY. package org.jetbrains.kotlin.sir /** * Generated from: [org.jetbrains.kotlin.sir.tree.generator.SwiftIrTree.struct] */
abstract class SirStruct : SirDeclarationContainer(), SirNamedDeclaration { abstract override val origin: SirOrigin abstract override val visibility: SirVisibility abstract override val documentation: String? abstract override var parent: SirDeclarationParent abstract override val name: String abstract override val declarations: List<SirDeclaration> }<|endoftext|>
val signature = getCallableSignature(functionProto, nameResolver, typeTable) ?: return emptyList() return findJvmBinaryClassAndLoadMemberAnnotations(signature) } override fun loadPropertyAnnotations( containerSource: DeserializedContainerSource?, propertyProto: ProtoBuf.Property, containingClassProto: ProtoBuf.Class?,
nameResolver: NameResolver, typeTable: TypeTable ): List<FirAnnotation> { val signature = getPropertySignature(propertyProto, nameResolver, typeTable, synthetic = true) ?: return emptyList()<|endoftext|>
import org.jetbrains.kotlin.gradle.targets.native.internal.* import org.jetbrains.kotlin.gradle.targets.native.internal.AddKotlinPlatformIntegersSupportLibrary import org.jetbrains.kotlin.gradle.targets.native.internal.CInteropCommonizedCInteropApiElementsConfigurationsSetupAction
import org.jetbrains.kotlin.gradle.targets.native.internal.SetupCInteropApiElementsConfigurationSideEffect import org.jetbrains.kotlin.gradle.targets.native.internal.SetupKotlinNativePlatformDependenciesForLegacyImport<|endoftext|>
t checkType { _<Array<out Int?>>() } } fun <T: Any> foo(l: Array<T>): Array<Array<T?>> = null!! fun test2(a: Array<out Int>) { val r: Array<out Array<out Int?>> = foo(a) val t = foo(a)
t checkType { _<Array<out Array<out Int?>>>() } }<|endoftext|>
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalUnsignedTypes::class}) @kotlin.internal.InlineOnly public inline fun <T> kotlin.Array<out T>.sumOf(selector: (T) -> kotlin.UInt): kotlin.UInt @kotlin.SinceKotlin(version = "1.5")
@kotlin.OverloadResolutionByLambdaReturnType @kotlin.jvm.JvmName(name = "sumOfULong") @kotlin.WasExperimental(markerClass = {kotlin.ExperimentalUnsignedTypes::class}) @kotlin.internal.InlineOnly<|endoftext|>
// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE class A<out T, in E> { fun foo(x: @UnsafeVariance T) {} fun foo(x: @UnsafeVariance T, y: List<@UnsafeVariance T>): @UnsafeVariance E = null!!
fun bar(): List<@UnsafeVariance E> = null!! } fun foo(x: A<String, Any?>, cs: CharSequence, ls: List<CharSequence>) { val y: A<CharSequence, String> = x y.foo(cs) val s: String = y.foo(cs, ls)<|endoftext|>
package org.jetbrains.kotlin.gradle.plugin import org.gradle.api.Project import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi /** * @suppress TODO: KT-58858 add documentation * ### Extension Point for the Kotlin Gradle Plugin *
* Note: Not stable for implementation: Custom implementations of this interface will not be supported by the Kotlin Gradle Plugin! * * #### Motivation * This [KotlinGradlePluginExtensionPoint] will be used to 'generically' extend parts of the Kotlin Gradle Plugin (internally and externally). * General Kotlin Gradle Plugin code will call into this 'semantically' structured extension points to load logic<|endoftext|>
val treeMaker = converter.treeMaker return treeMaker.TypeApply(treeMaker.SimpleName("Function" + (parameterTypes.size - 1)), parameterTypes) } private fun KtTypeParameterListOwner.getSubstitutions(actualType: KtUserType): SubstitutionMap { val arguments = actualType.typeArguments if (typeParameters.size != arguments.size) {
val kaptContext = converter.kaptContext val error = kaptContext.kaptError("${typeParameters.size} parameters are expected but ${arguments.size} passed") kaptContext.compiler.log.report(error) return emptyMap() } val substitutionMap = mutableMapOf<String, Pair<KtTypeParameter, KtTypeProjection>>()<|endoftext|>
import androidx.compose.runtime.Composable @Composable fun Something() { val x = unstable::method } """, """ class Unstable(var qux: Int = 0) { fun method(arg1: Int) {} } val unstable = Unstable() """ ) @Test
fun testUnstableExtensionReceiverFunctionReferenceNotMemoized() = verifyGoldenComposeIrTransform( """ import androidx.compose.runtime.Composable @Composable fun Something() { val x = unstable::method } """, """ class Unstable(var foo: Int = 0)<|endoftext|>
val headerCacheCompilation: StaticCacheCompilation? = headerCacheArtifactAndOptions?.let { (staticCacheArtifact, staticCacheOptions) -> StaticCacheCompilation( settings = settings, freeCompilerArgs = freeCompilerArgs, options = staticCacheOptions, createHeaderCache = true, pipelineType = settings.get(), dependencies = dependencies.forStaticCache(
klibCompilation.asKlibDependency(type = /* does not matter in fact*/ Library), settings.get<CacheMode>().useHeaders ), expectedArtifact = staticCacheArtifact ) } KlibCompilations(klibCompilation, staticCacheCompilation, headerCacheCompilation) } } private fun collectDependencies(<|endoftext|>
class TestAcceptedAnnotationsLegacyResolver : ScriptDependenciesResolver, AcceptedAnnotationsCheck { @AcceptedAnnotations(TestAnno1::class, TestAnno3::class) override fun resolve( script: ScriptContents, environment: Environment?, report: (ScriptDependenciesResolver.ReportSeverity, String, ScriptContents.Position?) -> Unit,
previousDependencies: KotlinScriptExternalDependencies? ): Future<KotlinScriptExternalDependencies?> { checkHasAnno1Annotation(script) return object : KotlinScriptExternalDependencies { override val classpath: Iterable<File> get() = classpathFromClassloader() override val imports: Iterable<String><|endoftext|>
override fun ResolutionCandidate.process(workIndex: Int) { resolvedCall.typeArgumentMappingByOriginal = callComponents.typeArgumentsToParametersMapper.mapTypeArguments(kotlinCall, candidateDescriptor.original).also { it.diagnostics.forEach(this@process::addDiagnostic) } } }
internal object NoTypeArguments : ResolutionPart() { override fun ResolutionCandidate.process(workIndex: Int) { assert(kotlinCall.typeArguments.isEmpty()) { "Variable call cannot has explicit type arguments: ${kotlinCall.typeArguments}. Call: $kotlinCall" } resolvedCall.typeArgumentMappingByOriginal = NoExplicitArguments }<|endoftext|>
private fun <T : ParameterInfo> addParameter(info: T, isValueParameter: Boolean): T { params.add(info) nextParameterOffset += info.type.size if (info !is CapturedParamInfo) { nextValueParameterIndex++ if (!isValueParameter) { valueParamFirstIndex++ } } return info }
fun listCaptured(): List<CapturedParamInfo> { return params.filterIsInstance<CapturedParamInfo>() } /*TODO use Parameters instead*/ fun listAllParams(): List<ParameterInfo> { return params } fun buildParameters(): Parameters {<|endoftext|>
return "^((${UNEXPECTED_VALUE}|${allowedValues.joinToString("|")})${ConcatMetricContainer.SEPARATOR}?)+$" } override fun anonymize(t: String): String { return if (t.matches(Regex(validationRegexp()))) { t } else {
t.split(ConcatMetricContainer.SEPARATOR).joinToString(ConcatMetricContainer.SEPARATOR) { if (allowedValues.contains(it)) it else UNEXPECTED_VALUE } } } }<|endoftext|>
internal fun <Node> annotationsOn(flags: KMutableProperty1<Node, Int>) = BooleanFlagDelegate(flags, Flag(ProtoFlags.HAS_ANNOTATIONS)) // Used for kotlin-metadata-jvm tests: public fun _flagAccess(kmClass: KmClass): Int = kmClass.flags public fun _flagAccess(kmFunc: KmFunction): Int = kmFunc.flags
public fun _flagAccess(kmType: KmType): Int = kmType.flags public fun _flagAccess(kmConstr: KmConstructor): Int = kmConstr.flags<|endoftext|>
package org.jetbrains.kotlin.fir.analysis.jvm.checkers.type import org.jetbrains.kotlin.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.checkers.MppCheckerKind import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.checkers.type.FirTypeRefChecker import org.jetbrains.kotlin.fir.analysis.jvm.checkers.expression.FirJvmModuleAccessibilityQualifiedAccessChecker import org.jetbrains.kotlin.fir.types.FirTypeRef<|endoftext|>
val diagnostic = chooseDiagnostic(LATEINIT_INTRINSIC_CALL_ON_NON_LITERAL_WARNING, LATEINIT_INTRINSIC_CALL_ON_NON_LITERAL) context.trace.report(diagnostic.on(reportOn)) } else {
val propertyReferenceResolvedCall = expression.callableReference.getResolvedCall(context.trace.bindingContext) ?: return val referencedProperty = propertyReferenceResolvedCall.resultingDescriptor if (referencedProperty !is PropertyDescriptor) { error("Lateinit intrinsic is incorrectly resolved not to a property: $referencedProperty") }<|endoftext|>
} internal fun dashSeparatedLowercaseName(nameParts: Iterable<String?>) = dashSeparatedLowercaseName(*nameParts.toList().toTypedArray()) internal fun dashSeparatedLowercaseName(vararg nameParts: String?): String {
val nonEmptyParts = nameParts.mapNotNull { it?.takeIf(String::isNotEmpty)?.toLowerCaseAsciiOnly() } return nonEmptyParts.joinToString(separator = "-") } internal fun String.decamelize(): String { return replace(upperCaseRegex) { val (first) = it.destructured<|endoftext|>
if (this.d != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>d<!>.funAny() if (this.d != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>d<!>.funNullableT()
if (this.d != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>d<!>.funNullableAny() if (this.d != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>d<!><|endoftext|>
COROUTINE_SUSPENDED } override suspend fun <U, S> DeepRecursiveFunction<U, S>.callRecursive(value: U): S = suspendCoroutineUninterceptedOrReturn { cont -> // calling another recursive function val function = block as DeepRecursiveFunctionBlock with(this@DeepRecursiveScopeImpl) { val currentFunction = this.function
if (function !== currentFunction) { // calling a different function -- create a trampoline to restore function ref this.function = function this.cont = crossFunctionCompletion(currentFunction, cont as Continuation<Any?>) } else { // calling the same function -- direct this.cont = cont as Continuation<Any?> } this.value = value }<|endoftext|>
0xbff921f6a3c9521bUL, 0x7ff8000000000000UL, 0xbfe0c152382d7366UL, 0x7ff8000000000000UL, 0xbfd02be9ce0b87cdUL, 0x7ff8000000000000UL, 0x7ff8000000000000UL, 0x7ff8000000000000UL,
0x7ff8000000000000UL, 0x7ff8000000000000UL, 0x7ff8000000000000UL, 0x3fece8276c3e139cUL, 0x7ff8000000000000UL, 0x7ff8000000000000UL, 0x7ff8000000000000UL, 0x7ff8000000000000UL,<|endoftext|>
/** * Represents a Kotlin task compiling using configurable [kotlinOptions]. * * See [KotlinCommonOptions] and its inheritors for possible Kotlin compiler options. * * **Note**: This interface is soft-deprecated and only exists for compatibility to configure Kotlin compilation options * using soft-deprecated [kotlinOptions].
* Instead, better to use [KotlinCompilationTask] to configure Kotlin compilation options via [KotlinCompilationTask.compilerOptions]. * * @see [KotlinCommonOptions] */ @Suppress("TYPEALIAS_EXPANSION_DEPRECATION") @Deprecated(<|endoftext|>
// !DIAGNOSTICS: -USELESS_ELVIS -UNUSED_EXPRESSION class X { fun toLong(): Long? = TODO() } fun getLong(): Long = TODO() fun test_1(list: List<X>) {
val props = list.map { <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Long?")!>it.toLong()<!> ?: <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Long")!>0<!> }<|endoftext|>
private class LoggingContext : SuiteContext, TestBodyContext{ val log: String get() = logHead + (lastRecord ?: "") private var indentation = "" override fun suite(name: String, ignored: Boolean, body: SuiteContext.() -> Unit) = indent { record("suite(\"$name\"${optionalIgnore(ignored)}) {")
runSafely { this.body() } record("}") } override fun test(name: String, ignored: Boolean, body: TestBodyContext.() -> Unit) = indent { val num = record("test(\"$name\"${optionalIgnore(ignored)}) {") runSafely { this.body() } if (!writtenSince(num)) {<|endoftext|>
ports, bubbles, cancelable, composed
};") }<|endoftext|>
// No need for the callee name since arguments are already generated context.calleeNamesForLambda.removeLast() val source = expression.toFirSourceElement() when (operationToken) { ELVIS -> return leftArgument.generateNotNullOrOther(rightArgument, source) ANDAND, OROR ->
return leftArgument.generateLazyLogicalOperation(rightArgument, operationToken == ANDAND, source) in OperatorConventions.IN_OPERATIONS -> return rightArgument.generateContainsOperation( leftArgument, operationToken == NOT_IN, source, expression.operationReference.toFirSourceElement(), ) in OperatorConventions.COMPARISON_OPERATIONS -><|endoftext|>
for (i in (3u.toUByte()..9u.toUByte() step 2).reversed()) { list2.add(i) if (list2.size > 23) break } if (list2 != listOf<UInt>(9u, 7u, 5u, 3u)) {
return "Wrong elements for (3u.toUByte()..9u.toUByte() step 2).reversed(): $list2" } val list3 = ArrayList<UInt>() for (i in (3u.toUShort()..9u.toUShort() step 2).reversed()) { list3.add(i)<|endoftext|>
testExecuteAfter10(InWorker, Park) @Test fun testExecuteAfter10InWorkerProcessQueue() = testExecuteAfter10(InWorker, ProcessQueue) @Test fun testExecuteAfter10InMainToWorkerNoYield() = testExecuteAfter10(InMainToWorker, NoYield)
private fun testExecuteAfter10(context: Context, yieldMethod: Yield) = test(ExecuteAfter10(yieldMethod), context, yieldMethod) private fun <F> test(method: ExecuteMethod<F>, context: Context, yieldMethod: Yield) { context.withWorker { worker -> fun execute(block: () -> Unit) {<|endoftext|>
/*p:foo(I) p:foo.I(a)*/i.a = 2 /*p:bar p:foo p:foo.Obj(a)*/Obj.a /*p:bar p:bar(foo) p:foo p:foo(foo) p:foo.Obj(foo)*/Obj.foo() var ii: /*p:bar p:foo*/I = /*p:foo*/Obj
/*p:foo(I) p:foo.I(a)*/ii.a /*p:foo(I) p:foo.I(foo)*/ii.foo() /*p:bar p:foo p:foo.Obj(b)*/Obj.b<|endoftext|>
returnType = builder.implementation.element, typeParameters = builder.implementation.element.params, isInline = !isEmpty, ) { if (!isEmpty) { addStarImport("kotlin.contracts") println("contract {") withIndent { println("callsInPlace(init, InvocationKind.EXACTLY_ONCE)") }
println("}") } print("return ") if (isEmpty) { println(builder.implementation.render(), "()") } else { println(builder.render(), "().apply(init).build()") } } } private fun BuilderField.needBackingField(fieldIsUseless: Boolean) =<|endoftext|>
package test.numbers import kotlin.test.* class NumbersJVMTest { @Test fun floatToBits() { val PI_F = kotlin.math.PI.toFloat() assertEquals(0x40490fdb, PI_F.toBits()) assertEquals(PI_F, Float.fromBits(0x40490fdb))
for (value in listOf(Float.NEGATIVE_INFINITY, -Float.MAX_VALUE, -1.0F, -Float.MIN_VALUE, -0.0F, 0.0F, Float.POSITIVE_INFINITY, Float.MAX_VALUE, 1.0F, Float.MIN_VALUE)) { assertEquals(value, Float.fromBits(value.toBits()))<|endoftext|>
if (c != null || <!SENSELESS_COMPARISON!>this.c != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit"), DEBUG_INFO_SMARTCAST!>this.c<!>.funT()
if (c != null || <!SENSELESS_COMPARISON!>this.c != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit"), DEBUG_INFO_SMARTCAST!>this.c<!>.funAny()<|endoftext|>
return scopeTower.interceptFunctionCandidates(this, name, result, location, dispatchReceiver, extensionReceiver) } private fun getConstructorsOfClassifier(classifier: ClassifierDescriptor?): List<ConstructorDescriptor> { val callableConstructors = when (classifier) {
is TypeAliasDescriptor -> if (classifier.canHaveCallableConstructors) classifier.constructors else emptyList() is ClassDescriptor -> if (classifier.canHaveCallableConstructors) classifier.constructors else emptyList() else -> emptyList() } return callableConstructors.filter { it.dispatchReceiverParameter == null } }<|endoftext|>
* @param declaration the IR representation of the generated class, or `null` if this class has no IR representation * (for example, if it's an anonymous object copied during inlining bytecode) */ fun generateClass(generator: ClassGenerator, declaration: IrClass?): ClassGenerator } /** * Similarly to ASM's [ClassWriter], provides methods that are used to generate parts of the class.
* [newField] and [newMethod] accept an IR element, which the compiler plugin can use to implement its custom logic. */ interface ClassGenerator { fun defineClass(version: Int, access: Int, name: String, signature: String?, superName: String, interfaces: Array<out String>) fun newField(<|endoftext|>
@Ann(1) constructor(x: Int, y: Int = 2, z: Int) } class B @Ann(1) constructor(x: Int, y: Int = 2, z: Int) {} fun test(name: String, annotations: Array<out Annotation>) { assertEquals(1, annotations.filterIsInstance<Ann>().single().x, "$name[0]") }
fun testAbsence(name: String, annotations: Array<out Annotation>) { assertEquals(0, annotations.filterIsInstance<Ann>().size, "$name") } fun box(): String { val foo = A::class.java.getDeclaredMethods().first { it.getName() == "foo" } test("foo", foo.getDeclaredAnnotations())<|endoftext|>
@kotlin.SinceKotlin(version = "1.4") @kotlin.internal.InlineOnly public inline fun kotlin.BooleanArray.randomOrNull(): kotlin.Boolean? @kotlin.SinceKotlin(version = "1.4")
public fun kotlin.BooleanArray.randomOrNull(random: kotlin.random.Random): kotlin.Boolean? @kotlin.SinceKotlin(version = "1.4") @kotlin.internal.InlineOnly public inline fun kotlin.ByteArray.randomOrNull(): kotlin.Byte?<|endoftext|>
// MODULE: m1-common // FILE: common.kt expect var v1: Boolean expect var v2: Boolean internal set expect var v3: Boolean internal set expect open class C { var foo: Boolean } expect open class C2 { var foo: Boolean } // MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt actual var <!ACTUAL_WITHOUT_EXPECT!>v1<!>: Boolean = false private set actual var v2: Boolean = false actual var <!ACTUAL_WITHOUT_EXPECT!>v3<!>: Boolean = false private set actual open class C {<|endoftext|>
package org.jetbrains.kotlin.ir.interpreter.proxy.reflection import org.jetbrains.kotlin.builtins.functions.BuiltInFunctionArity import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression import org.jetbrains.kotlin.ir.expressions.IrReturn<|endoftext|>
resourcesPathConfigurationName: String = naming.name(RESOURCES_PATH), ): KotlinCompilationConfigurationsContainer { val compilationCoordinates = "${target.disambiguationClassifier}/$compilationName" /* Support deprecated configurations */ val deprecatedCompileConfiguration = target.project.configurations.findDependencyScope(
ConfigurationNaming.Default(target, compilationName).name(COMPILE) )?.apply { setupAsLocalTargetSpecificConfigurationIfSupported(target) isVisible = false description = "Dependencies for $compilation (deprecated, use '${implementationConfigurationName} ' instead)." }<|endoftext|>
declaration.transformDeclarationsFlat { (it as? IrProperty)?.transform() } return declaration } private fun IrProperty.transform(): List<IrDeclaration>? { val delegate = getPropertyReferenceForOptimizableDelegatedProperty() ?: return null val oldField = backingField ?: return null
val receiver = (delegate.dispatchReceiver ?: delegate.extensionReceiver) ?.transform(this@PropertyReferenceDelegationTransformer, null) backingField = receiver?.takeIf { !it.canInline(parents.toSet()) }?.let { context.irFactory.buildField { updateFrom(oldField)<|endoftext|>
* @param kotlinNativeBundleConfiguration Gradle configuration for Kotlin Native Bundle * @param kotlinNativeVersion The version of Kotlin/Native to install * @param bundleDir The directory to store the Kotlin/Native bundle. * @param reinstallFlag A flag indicating whether to reinstall the bundle.
* @param konanTargets The set of KonanTarget objects representing the targets for the Kotlin/Native bundle. * @param overriddenKonanHome Overridden konan home if present. * @return kotlin native version if toolchain was used, path to konan home if konan home was used */ internal fun prepareKotlinNativeBundle( project: Project,<|endoftext|>
// ISSUE: KT-49160 // CHECK_TYPE_WITH_EXACT fun test() { val outerBuildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> outerBuild@ { object { fun anonymousObjectMember() { val innerBuildee = build innerBuild@ { [email protected](TargetType())
[email protected](TargetType()) } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests checkExactType<Buildee<TargetType>>(innerBuildee) } } } // exact type equality check — turns unexpected compile-time behavior into red code<|endoftext|>
val out = PrintStream(stream) val exitCode = CompilerRunnerUtil.invokeExecMethod(K2JVMCompiler::class.java.name, argsArray, env, out) val reader = BufferedReader(StringReader(stream.toString())) CompilerOutputParser.parseCompilerMessagesFromReader(env.messageCollector, reader, env.outputItemsCollector) return exitCode
} finally { moduleFile.delete() } } } abstract class AbstractK1JvmLookupTrackerTest : AbstractJvmLookupTrackerTest() { override var filterBuiltins = true override var distinguishPackageAndClassLookups = false override fun setUp() { super.setUp()<|endoftext|>
override fun IrDeclarationContainer.addTransformedStaticAtomic(atomicProperty: IrProperty, index: Int): IrProperty = addVolatileProperty(atomicProperty, index) private fun IrDeclarationContainer.addVolatileProperty(from: IrProperty, index: Int): IrProperty { /** * Atomic property [from] is replaced with the volatile field of the value type stored in [from]
* which is atomically updated via atomic intrinsics (see details about intrinsics in [kotlin.concurrent.AtomicInt]). * * Volatile field has the same visibility as the original atomic property. * * internal val a = atomic(0) --> internal @Volatile var a: Int = 0 */ val parentContainer = this<|endoftext|>
import org.jetbrains.kotlin.fir.references.builder.buildBackingFieldReference import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.references.impl.FirSimpleNamedReference import org.jetbrains.kotlin.fir.resolve.*
import org.jetbrains.kotlin.fir.resolve.calls.* import org.jetbrains.kotlin.fir.resolve.calls.tower.FirTowerResolver import org.jetbrains.kotlin.fir.resolve.calls.tower.TowerGroup<|endoftext|>
// !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER data class A(val x: Int, val y: String) data class B(val u: Double, val w: Short) fun foo(block: (A, B) -> Unit) { } fun bar() {
foo { (<!REDECLARATION!>a<!>, <!REDECLARATION!>a<!>), b -> a checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Int>() }<|endoftext|>
// IGNORE_FE10 // MODULE: context // FILE: context.kt fun test() { <caret_context>Unit } fun foo() {} // MODULE: contextFragment // MODULE_KIND: CodeFragment // CONTEXT_MODULE: context // FILE: contextFragment.kt // CODE_FRAGMENT_KIND: BLOCK fun bar() {}
<caret_context>bar() // MODULE: main // MODULE_KIND: CodeFragment // CONTEXT_MODULE: contextFragment // FILE: fragment.kt // CODE_FRAGMENT_KIND: BLOCK <caret>bar()<|endoftext|>
// Auto-generated by GenerateSteppedRangesCodegenTestData. Do not edit! // WITH_STDLIB // DONT_TARGET_EXACT_BACKEND: JVM // !LANGUAGE: +RangeUntilOperator @file:OptIn(ExperimentalStdlibApi::class) import kotlin.test.* fun box(): String {
val uintList = mutableListOf<UInt>() for (i in 1u..<5u step 1 step 1) { uintList += i } assertEquals(listOf(1u, 2u, 3u, 4u), uintList) val ulongList = mutableListOf<ULong>()<|endoftext|>
val substituted = DeserializedTypeAliasDescriptor( storageManager, containingDeclaration, annotations, name, visibility, proto, nameResolver, typeTable, versionRequirementTable, containerSource ) substituted.initialize( declaredTypeParameters, substitutor.safeSubstitute(underlyingType, Variance.INVARIANT).asSimpleType(),
substitutor.safeSubstitute(expandedType, Variance.INVARIANT).asSimpleType() ) return substituted } override fun getTypeConstructorTypeParameters(): List<TypeParameterDescriptor> = typeConstructorParameters }<|endoftext|>
class D(val a: String, val b: Boolean) fun foo(p: Boolean, v: D?): String { if (p && v!!.b) <!DEBUG_INFO_SMARTCAST!>v<!>.a else v<!UNSAFE_CALL!>.<!>a
if (p && v!! == D("?", false)) <!DEBUG_INFO_SMARTCAST!>v<!>.a else v<!UNSAFE_CALL!>.<!>a if (p || v!!.b) v<!UNSAFE_CALL!>.<!>a else <!DEBUG_INFO_SMARTCAST!>v<!>.a<|endoftext|>
// IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. // Range and progression-based loops generated with Kotlin compiler should be // as close as possible to Java counter loops ('for (int i = a; i < b; ++i) { ... }'). // Otherwise it may result in performance regression due to missing HotSpot optimizations.
// Run Kotlin compiler benchmarks (https://github.com/Kotlin/kotlin-benchmarks) // with compiler built from your changes if you are not sure. fun box(): String { for ((i, v) in (4..7).withIndex().reversed()) { } return "OK" } // We do not optimize `withIndex().reversed()`<|endoftext|>
val range2 = (5u.toUByte() downTo 3u.toUByte()).reversed() for (i in range2) { list2.add(i) if (list2.size > 23) break } if (list2 != listOf<UInt>(3u, 4u, 5u)) {
return "Wrong elements for (5u.toUByte() downTo 3u.toUByte()).reversed(): $list2" } val list3 = ArrayList<UInt>() val range3 = (5u.toUShort() downTo 3u.toUShort()).reversed() for (i in range3) { list3.add(i)<|endoftext|>
get() = File(AbstractKotlinJpsBuildTestCase.TEST_DATA_PATH + "/../../../compiler/testData/classpathOrder").absoluteFile } fun testClasspathOrderForCLI() { MockLibraryUtil.compileKotlin(sourceDir.path, tmpdir) } fun testClasspathOrderForModuleScriptBuild() {
val xmlContent = KotlinModuleXmlBuilder().addModule( "name", File(tmpdir, "output").absolutePath, listOf(sourceDir), listOf(JvmSourceRoot(sourceDir)), listOf(PathUtil.kotlinPathsForDistDirectoryForTests.stdlibPath), emptyList(), null,<|endoftext|>
z += w[1] + fetch64(s, pos + len - tailDone) w[1] += v[0] v = weakHashLen32WithSeeds(s, pos + len - tailDone, v[0] + z, v[1]) v[0] *= k0 } x = hashLen16(x, v[0])
y = hashLen16(y + z, w[0]) return Hash128Bits(hashLen16(x + v[1], w[1]) + y, hashLen16(x + w[1], y + v[1])) } fun cityHash128(s: ByteArray, pos: Int = 0, len: Int = s.size): Hash128Bits {<|endoftext|>
private fun totalKotlinPsi(onlyPsi: Boolean) { val path = System.getProperty("user.dir") val root = File(path) var counter = 0 var time = 0L if (onlyPsi) println("Psi generation") else println("Fir from Psi converter") println("BASE PATH: $path")
for (file in root.walkTopDown()) { if (file.isDirectory) continue /* TODO: fix this, please !!! */ if (file.path.contains("kotlin-native") || file.path.lowercase().contains("testdata") || file.path.contains("resources") ) continue if (file.extension != "kt") continue<|endoftext|>
<!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T: UserInterface> TestTypeParameterWithIdenticalUpperBoundsBReverse(arg: T)<!> {} class TestTypeParameterWithIdenticalUpperBoundsC<T: UserInterface> {
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) <!CONFLICTING_OVERLOADS!>constructor(arg: Invariant<T>)<!> } <!CONFLICTING_OVERLOADS!>fun <T: UserInterface> TestTypeParameterWithIdenticalUpperBoundsC(arg: Invariant<T>)<!> {}<|endoftext|>
After resolution, it will be either represented as an assignment (`x = x.plus(y)`) or a call (`x.plusAssign(y)`). Augmented assignments with an indexed access as receiver are represented as [FirIndexedAccessAugmentedAssignment]. """.trimIndent() } incrementDecrementExpression.configure {
+booleanField("isPrefix") +field("operationName", nameType) +field("expression", expression) +field("operationSource", sourceElementType, nullable = true) } equalityOperatorCall.configure { +field("operation", operationType) } whenBranch.configure { +field("condition", expression).withTransform()<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!> <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!><!UNSAFE_CALL!>.<!>propAny
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!><!UNSAFE_CALL!>.<!>funAny() } } // TESTCASE NUMBER: 13 inline fun <reified T, reified K, reified L>case_13(x: Any?) { if (!(x !is K !is T !is L)) {<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters<out Inv<out {Comparable<*> & java.io.Serializable}>, out Inv<out {Comparable<*> & java.io.Serializable}>> & InterfaceWithTwoTypeParameters<out Inv<out {Comparable<*> & java.io.Serializable
}>, out Inv<out {Comparable<*> & java.io.Serializable}>>?")!>x<!>.ip2test()<|endoftext|>
resourcesConfiguration.incoming.artifactView { it.isLenient = true }.files } ?: return compilation.project.files().also { compilation.project.reportDiagnostic( KotlinToolingDiagnostics.MissingResourcesConfigurationForTarget(compilation.target.name) ) } } } val propertyName: String
get() = when (this) { VariantReselection -> "variantReselection" ResourcesConfiguration -> "resourcesConfiguration" } companion object { fun fromProperty(name: String): KotlinTargetResourcesResolutionStrategy? = when (name) { VariantReselection.propertyName -> VariantReselection ResourcesConfiguration.propertyName -> ResourcesConfiguration else -> null<|endoftext|>
// FIR_IDENTICAL // JAVAC_EXPECTED_FILE // FILE: com/winterbe/domain/IEntity.java package com.winterbe.domain; import com.winterbe.observer.ObserverSupport; public interface IEntity { ObserverSupport getObserverSupport(); } // FILE: 1.kt package com.winterbe.observer
import com.winterbe.domain.IEntity abstract class Observer : List<IEntity> // FILE: 2.kt package com.winterbe.observer import com.winterbe.domain.IEntity class ObserverSupport<T : IEntity>(private val observers: List<Observer>)<|endoftext|>
abstract class <!CANNOT_WEAKEN_ACCESS_PRIVILEGE, CANNOT_WEAKEN_ACCESS_PRIVILEGE!>C3<!> : IVal, WithProtectedVar()
abstract class <!CANNOT_WEAKEN_ACCESS_PRIVILEGE, CANNOT_WEAKEN_ACCESS_PRIVILEGE!>D3<!> : IVal, WithInternalVar() abstract class E3 : IVal, WithVarInternalSet() abstract class F3 : IVal, WithVarProtectedSet() abstract class G3 : IVal, WithVarPrivateSet()<|endoftext|>
@Throws(*<!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>[<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>UE<!>::class<!>]<!>) suspend fun suspendThrowsSpreadLiteralWithUnresolved() {}
@Throws(*<!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>arrayOf(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>UE<!>::class<!>)<!>) suspend fun suspendThrowsSpreadArrayOfUnresolved() {}<|endoftext|>
x.<!UNRESOLVED_REFERENCE!>getFirst<!>() x.<!UNRESOLVED_REFERENCE!>getLast<!>() x.<!FUNCTION_CALL_EXPECTED!>first<!> x.<!FUNCTION_CALL_EXPECTED!>last<!> y.addFirst("")
y.addLast("") y.removeFirst() y.removeLast() y.getFirst() y.getLast() y.first y.last } // Test for collections with (add/remove)(First/Last) methods which are not covered by autotests<|endoftext|>
internal annotation class Escapes(val who: Int) // Decyphering of binary values can be found in EscapeAnalysis.kt @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.BINARY) internal annotation class PointsTo(vararg val onWhom: Int) @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.BINARY)
internal annotation class TypedIntrinsic(val kind: String) @Target(AnnotationTarget.CONSTRUCTOR) @Retention(AnnotationRetention.BINARY) internal annotation class ConstantConstructorIntrinsic(val kind: String) /** * Indicates that `@SymbolName external` function is implemented in library-stored bitcode * and doesn't have native dependencies. */<|endoftext|>
// FILE: ClassWithExternalAnnotatedMembers.java import org.jetbrains.annotations.NotNull; public class ClassWithExternalAnnotatedMembers { public void method(String s) { } public void method(@NotNull Integer i) { } } // FILE: usage.kt fun test() { val instance = ClassWithExternalAnnotatedMembers()
val i: Int? = null instance.method(<!TYPE_MISMATCH!>i<!>) val s: String? = null instance.method(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>s<!>) val b: Boolean? = null<|endoftext|>
// Super calls to Throwable properties are not supported // IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR_ES6 class MyThrowable(message: String? = null, cause: Throwable? = null) : Throwable(message, cause) { override val message: String? get() = "My message: " + super.message
override val cause: Throwable? get() = super.cause ?: this } fun box(): String { try { throw MyThrowable("test") } catch (t: MyThrowable) { if (t.cause != t) return "fail t.cause" if (t.message != "My message: test") return "fail t.message" return "OK"<|endoftext|>
* For K1 implementation see: [org.jetbrains.kotlin.resolve.jvm.checkers.UnsupportedSyntheticCallableReferenceChecker] */ object FirUnsupportedSyntheticCallableReferenceChecker : FirExpressionChecker<FirCallableReferenceAccess>(MppCheckerKind.Common) {
override fun check(expression: FirCallableReferenceAccess, context: CheckerContext, reporter: DiagnosticReporter) { val parent = context.containingElements.let { check(it.last() === expression) it[it.lastIndex - 1] } // We allow resolution of top-level callable references to synthetic Java extension properties in the delegate position. See KT-47299<|endoftext|>
fun case_4(value_1: Int, value_2: String, value_3: String) { when { value_1 == 1 -> "..." + value_2 + "" + "$value_3" + "..." value_1 == 2 -> value_2 + getString() } } // TESTCASE NUMBER: 5
fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) { when { value_1 == 1 -> when { value_2 > 1000 -> "1" value_2 > 100 -> "2" else -> "3" } value_1 == 2 -> when { value_2 > 1000 -> "1"<|endoftext|>
internal class KtFe10FileScope( private val ktFile: KtFile, private val analysisContext: Fe10AnalysisContext, override val token: KtLifetimeToken, ) : KtScope { override fun getPossibleCallableNames(): Set<Name> = withValidityAssertion {
ktFile.declarations.mapNotNullTo(mutableSetOf()) { (it as? KtCallableDeclaration)?.nameAsName } } override fun getPossibleClassifierNames(): Set<Name> = withValidityAssertion { ktFile.declarations.mapNotNullTo(mutableSetOf()) { (it as? KtClassLikeDeclaration)?.nameAsName }<|endoftext|>
using the provided [transform] function applied to each pair of elements. The returned list has length of the shortest collection. """ } sample("samples.collections.Iterables.Operations.zipIterableWithTransform") typeParam("R") typeParam("V") returns("List<V>") body { """ val first = iterator()
val second = other.iterator() val list = ArrayList<V>(minOf(collectionSizeOrDefault(10), other.collectionSizeOrDefault(10))) while (first.hasNext() && second.hasNext()) { list.add(transform(first.next(), second.next())) } return list """ }<|endoftext|>
// Named implementation. override fun getName(): String = name } abstract class AbstractExecutable( name: String, baseName: String, buildType: NativeBuildType, compilation: KotlinNativeCompilation ) : NativeBinary(name, baseName, buildType, compilation) class Executable constructor( name: String, baseName: String,
buildType: NativeBuildType, compilation: KotlinNativeCompilation ) : AbstractExecutable(name, baseName, buildType, compilation) { override val outputKind: NativeOutputKind get() = NativeOutputKind.EXECUTABLE override var baseName: String get() = super.baseName set(value) { super.baseName = value<|endoftext|>
import org.jetbrains.kotlin.fir.languageVersionSettings import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.scopes.*
import org.jetbrains.kotlin.fir.scopes.impl.FirDefaultStarImportingScope import org.jetbrains.kotlin.fir.scopes.impl.TypeAliasConstructorsSubstitutingScope import org.jetbrains.kotlin.fir.symbols.impl.*<|endoftext|>
open fun getClassDescriptor(classOrObject: KtClassOrObject, location: LookupLocation): ClassDescriptor = findClassDescriptor(classOrObject, location) fun getScriptDescriptor(script: KtScript, location: LookupLocation): ClassDescriptorWithResolutionScopes = findClassDescriptor(script, location) as ClassDescriptorWithResolutionScopes
private fun findClassDescriptorIfAny( classObjectOrScript: KtNamedDeclaration, location: LookupLocation ): ClassDescriptor? { val scope = getMemberScopeDeclaredIn(classObjectOrScript, location) // Why not use the result here. Because it may be that there is a redeclaration:<|endoftext|>
!this.isBoolean() && !this.isFloat() && !this.isDouble() && !this.isChar() } private fun IrType.isUnsignedInteger(): Boolean = !isNullable() && UnsignedType.values().any { it.classId == this.getClass()?.classId }
private fun evaluateIntegerCoercion(value: IrTypeOperatorCall): LLVMValueRef { context.log{"evaluateIntegerCoercion : ${ir2string(value)}"} val type = value.typeOperand assert(type.isPrimitiveInteger() || type.isUnsignedInteger()) val result = evaluateExpression(value.argument) assert(value.argument.type.isInt())<|endoftext|>
// FIR_IDENTICAL // JVM_TARGET: 1.8 // WITH_STDLIB // MODULE: lib // FILE: tests.kt interface BaseTest { fun getProject() = Any() } open class GradleTestCase { @get:JvmName("myProject") val project = Any() }
open class GradleCodeInsightTestCase: GradleTestCase(), BaseTest // MODULE: main(lib) // FILE: main.kt class GradleActionTest: GradleCodeInsightTestCase() // K1: ok, K2: CONFLICTING_INHERITED_JVM_DECLARATIONS<|endoftext|>
import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives import org.jetbrains.kotlin.test.model.TestFile import org.jetbrains.kotlin.test.model.TestModule import org.jetbrains.kotlin.test.services.AdditionalSourceProvider import org.jetbrains.kotlin.test.services.TestServices
import java.io.File import java.io.FileFilter class WasmWasiBoxTestHelperSourceProvider(testServices: TestServices) : AdditionalSourceProvider(testServices) { override fun produceAdditionalFiles(globalDirectives: RegisteredDirectives, module: TestModule): List<TestFile> { val boxTestRunFile = File("wasm/wasm.tests/wasiBoxTestRun.kt")<|endoftext|>
val w25 = W2 { s: String -> s.length } // oi+ ni+ val i25: E1 = id { s: String -> s.length } // oi- ni+ val w26 = W2(id { s: String -> this + s.length }) // oi- ni+
val w26a = W2(id { s -> this + s.length }) // oi+ ni+ val i26: E1 = id { s: String -> this + s.length } // oi- ni+ val i26a: E1 = id { s -> this + s.length } // oi+ ni+ val e = E.VALUE<|endoftext|>
* The same instance of a foreign annotation is shared at least between two declarations – the original declaration and this call site, * so simultaneous modification of the annotation can lead to undefined behavior. * * * Wrong context on the call site. * It is possible that the annotation can use arguments which are not visible from the call site. * * @return The collection of [FirBasedSymbol]s which have to be resolved on
* [annotation arguments][org.jetbrains.kotlin.fir.declarations.FirResolvePhase.ANNOTATION_ARGUMENTS] phase before [this] declaration. * * @see LLFirImplicitBodyTargetResolver * @see LLFirAnnotationArgumentsTargetResolver */<|endoftext|>
public inline fun <R : kotlin.Comparable<R>> kotlin.UIntArray.minByOrNull(selector: (kotlin.UInt) -> R): kotlin.UInt? @kotlin.SinceKotlin(version = "1.4") @kotlin.ExperimentalUnsignedTypes @kotlin.internal.InlineOnly
public inline fun <R : kotlin.Comparable<R>> kotlin.ULongArray.minByOrNull(selector: (kotlin.ULong) -> R): kotlin.ULong? @kotlin.SinceKotlin(version = "1.4") @kotlin.ExperimentalUnsignedTypes @kotlin.internal.InlineOnly<|endoftext|>
val printableDeclarations = declarations .filter { it !is IrConstructor } .filter { it.origin != IrDeclarationOrigin.FAKE_OVERRIDE } if (printableDeclarations.isNotEmpty()) { bracedBlock { printableDeclarations.printJoin("\n") } } else { println() } }
override fun visitBreak(jump: IrBreak) { print("break") if (jump.label != null) { print("@") print(jump.label) } } override fun visitContinue(jump: IrContinue) { print("continue") if (jump.label != null) { print("@") print(jump.label) }<|endoftext|>
val TYPEALIAS_EXPANSION_DEPRECATION: KtDiagnosticFactory3<FirBasedSymbol<*>, FirBasedSymbol<*>, String> by warning3<PsiElement, FirBasedSymbol<*>, FirBasedSymbol<*>, String>(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED)
val API_NOT_AVAILABLE: KtDiagnosticFactory2<ApiVersion, ApiVersion> by error2<PsiElement, ApiVersion, ApiVersion>(SourceElementPositioningStrategies.SELECTOR_BY_QUALIFIED)<|endoftext|>
_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, f ->
f(O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, "OK") } }<|endoftext|>
package org.jetbrains.kotlin.fir.plugin import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.FirDeclaration import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
import org.jetbrains.kotlin.fir.extensions.FirDeclarationPredicateRegistrar import org.jetbrains.kotlin.fir.extensions.FirStatusTransformerExtension import org.jetbrains.kotlin.fir.extensions.predicate.DeclarationPredicate import org.jetbrains.kotlin.fir.extensions.predicateBasedProvider<|endoftext|>
assertEquals(null, readOnlyIntNWrapperN?.value) intNWrapperN = IntNWrapper(65) assertEquals(65, readOnlyIntNWrapperN?.value) intNWrapperN = IntNWrapper(null) assertEquals(null, readOnlyIntNWrapperN?.value)
fooWrapper = FooWrapper(Foo("cat")) assertEquals("cat", readOnlyFooWrapper.foo.s) assertEquals(null, readOnlyFooWrapperN?.foo?.s) fooWrapperN = FooWrapper(Foo("dog")) assertEquals("dog", readOnlyFooWrapperN?.foo?.s)<|endoftext|>
if (s != 0) throw AssertionError("$s") } fun testMaxUIdownToMinUI() { val xs = ArrayList<UInt>() for (i in MinUI downTo MaxUI) { xs.add(i) if (xs.size > 23) break } if (xs.size > 0) {
throw AssertionError("Wrong elements for MaxUI..MinUI: $xs") } } fun testMaxULdownToMinUL() { val xs = ArrayList<ULong>() for (i in MinUL downTo MaxUL) { xs.add(i) if (xs.size > 23) break } if (xs.size > 0) {<|endoftext|>
val items = intArrayOf(1, 2, Int.MAX_VALUE).apply { shuffle() } assertTrue(items.minOf { it.compareTo(middle).toFloat().pow(0.5F) }.isNaN()) assertTrue(items.minOfOrNull { it.compareTo(middle).toFloat().pow(0.5F) }!!.isNaN())
assertTrue(items.maxOf { it.compareTo(middle).toFloat().pow(0.5F) }.isNaN()) assertTrue(items.maxOfOrNull { it.compareTo(middle).toFloat().pow(0.5F) }!!.isNaN())<|endoftext|>
parent(expression) +field("kind", type(Packages.exprs, "IrConstKind").withArgs(t)) +field("value", t) } val constantValue: Element by element(Expression) { transformByChildren = true kind = ImplementationKind.SealedClass parent(expression) }
val constantPrimitive: Element by element(Expression) { parent(constantValue) +field("value", const.withArgs("T" to TypeRef.Star)) } val constantObject: Element by element(Expression) { parent(constantValue) +field("constructor", constructorSymbolType)<|endoftext|>
// FIR_IDENTICAL // FILE: Super.java public class Super { public boolean foo; public boolean bar; public void setFoo(boolean foo) { this.foo = foo; } } // FILE: b.kt public class Sub: Super() { } fun main() { val x = Sub() x.foo = true
x.bar = true }<|endoftext|>
val y = (bswap((v + w) * mul) + g) * mul val z = e + f + c a = bswap((x + z) * mul + y) + b b = shiftMix((z + a) * mul + d + h) * mul return b + x }
public fun cityHash64(s: ByteArray, pos: Int = 0, len: Int = s.size): ULong { var pos = pos var len = len if (len <= 32) { return if (len <= 16) { hashLen0to16(s, pos, len) } else { hashLen17to32(s, pos, len) }<|endoftext|>
resolveState = resolvePhase.asResolveState() } override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) { annotations.forEach { it.accept(visitor, data) } controlFlowGraphReference?.accept(visitor, data) declarations.forEach { it.accept(visitor, data) }
parameters.forEach { it.accept(visitor, data) } contextReceivers.forEach { it.accept(visitor, data) } } override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirScriptImpl { transformAnnotations(transformer, data)<|endoftext|>
UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.kClassClass.typeWith(containerClass.defaultType), containerClass.symbol, containerClass.defaultType ) irClass.annotations += IrConstructorCallImpl.fromSymbolOwner(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, symbols.repeatableConstructor.returnType, symbols.repeatableConstructor.symbol, 0 ).apply { putValueArgument(0, containerReference) } } private fun IrConstructorCall.getValueArgument(name: Name): IrExpression? {<|endoftext|>
import org.jetbrains.kotlin.analysis.api.fir.findPsi import org.jetbrains.kotlin.analysis.api.fir.symbols.pointers.FirCallableSignature import org.jetbrains.kotlin.analysis.api.fir.symbols.pointers.KtFirConstructorSymbolPointer
import org.jetbrains.kotlin.analysis.api.fir.symbols.pointers.createOwnerPointer import org.jetbrains.kotlin.analysis.api.fir.utils.cached import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion<|endoftext|>
fun getStaticFunctionNames(thisDescriptor: ClassDescriptor, c: LazyJavaResolverContext): List<Name> fun generateStaticFunctions( thisDescriptor: ClassDescriptor, name: Name, result: MutableCollection<SimpleFunctionDescriptor>, c: LazyJavaResolverContext, )
fun generateConstructors(thisDescriptor: ClassDescriptor, result: MutableList<ClassConstructorDescriptor>, c: LazyJavaResolverContext) fun getNestedClassNames(thisDescriptor: ClassDescriptor, c: LazyJavaResolverContext): List<Name><|endoftext|>
order.append("H") return i } fun x(i: Int): Int { order.append("X") return i } fun minValue() = Int.MIN_VALUE fun box(): String {
expectOrder("x(0) in low(1) until high(3)", "LHX") { assertFalse(x(0) in low(1) until high(3)) } expectOrder("0 in low(1) until high(3)", "LH") { assertFalse(0 in low(1) until high(3)) }<|endoftext|>
d?.<!UNRESOLVED_REFERENCE!>foo<!>() e?.<!UNRESOLVED_REFERENCE!>foo<!>() f?.<!UNRESOLVED_REFERENCE!>foo<!>() g?.<!UNRESOLVED_REFERENCE!>foo<!>()
h?.<!UNRESOLVED_REFERENCE!>foo<!>() }<|endoftext|>
override var test: <!VAR_TYPE_MISMATCH_ON_OVERRIDE!>String<!> = "Test" } open class D() : B() { override var test: <!VAR_TYPE_MISMATCH_ON_OVERRIDE!>Char<!> = '\n' }
class E<T : <!FINAL_UPPER_BOUND!>Double<!>>(val value: T) : B() { override var test: <!VAR_TYPE_MISMATCH_ON_OVERRIDE!>T<!> = value } open class F<T : Number>(val value: T) { open var rest: T = value }<|endoftext|>
if ('0' in '1'..<'3' != range0.contains('0')) throw AssertionError() if ('0' !in '1'..<'3' != !range0.contains('0')) throw AssertionError() if (!('0' in '1'..<'3') != !range0.contains('0')) throw AssertionError()
if (!('0' !in '1'..<'3') != range0.contains('0')) throw AssertionError() // no local optimizations if (element0 in '1'..<'3' != range0.contains(element0)) throw AssertionError()<|endoftext|>
private val objcMsgSend = llvm.externalNativeRuntimeFunction( "objc_msgSend", LlvmRetType(llvm.int8PtrType), listOf(LlvmParamType(llvm.int8PtrType), LlvmParamType(llvm.int8PtrType)), isVararg = true ).toConstPointer()
val objcRelease = llvm.externalNativeRuntimeFunction( "llvm.objc.release", LlvmRetType(llvm.voidType), listOf(LlvmParamType(llvm.int8PtrType)), listOf(LlvmFunctionAttribute.NoUnwind) ) val objcAlloc = llvm.externalNativeRuntimeFunction(<|endoftext|>
encodeCDPMethodCall<CDPMethodInvocationResultUnit, ResumeRequestParams>(messageId, "Debugger.resume", null) } } @Serializable class SetBreakpointByUrlResult private constructor( /** * Id of the created breakpoint for further reference. */ val breakpointId: BreakpointId, /**
* List of the locations this breakpoint resolved into upon addition. */ val locations: List<Location> ) : CDPMethodInvocationResult() @Serializable private class SetBreakpointByUrlRequestParams( val lineNumber: Int, val url: String, val scriptHash: String? = null, val columnNumber: Int? = null,<|endoftext|>