prompt
stringlengths
1
924
completion
stringlengths
14
937
val mappingsClass by lazy { context.irFactory.buildClass { name = Name.identifier("WhenMappings") origin = JvmLoweredDeclarationOrigin.ENUM_MAPPINGS_FOR_WHEN }.apply { createImplicitParameterDeclarationWithWrappedDescriptor() } }
fun getMappingForClass(enumClass: IrClass): EnumMappingClass = mappings.getOrPut(enumClass) { EnumMappingClass(mappingsClass.addField { name = Name.identifier("\$EnumSwitchMapping\$${mappings.size}") type = intArray.defaultType<|endoftext|>
package org.jetbrains.kotlin.fir.analysis.jvm.checkers.expression import com.intellij.openapi.vfs.VirtualFile import org.jetbrains.kotlin.KtVirtualFileSourceFile import org.jetbrains.kotlin.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.diagnostics.reportOn
import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.analysis.checkers.MppCheckerKind import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirQualifiedAccessExpressionChecker<|endoftext|>
if (funWithReturnsNull(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null) == null) { println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>()) println(value_2?.toByte())
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3)) } } } // TESTCASE NUMBER: 11 fun case_11(value_1: Any?, value_2: Any?, value_3: Any?) {<|endoftext|>
fun minMaxEmpty() { val empty = listOf<Int>() assertNull(empty.minOrNull()) assertNull(empty.maxOrNull()) assertFailsWith<NoSuchElementException> { empty.min() } assertFailsWith<NoSuchElementException> { empty.max() } } @Test fun minMaxDouble() {
val zeroes = listOf(0.0, -0.0).shuffled() val NaNs = listOf(0.0, Double.NaN).shuffled() assertIsNegativeZero(zeroes.min().toDouble()) assertIsNegativeZero(zeroes.minOrNull()!!.toDouble()) assertTrue(NaNs.min().isNaN())<|endoftext|>
val <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS!><T : <!UNRESOLVED_REFERENCE!>__UNRESOLVED__<!>><!> x1: Map<Int, Int> = mapOf(1 to 1)
var <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS!><T : <!UNRESOLVED_REFERENCE!>__UNRESOLVED__<!>><!> x2: Map<Int, Int> = mapOf(1 to 1) } /* * TESTCASE NUMBER: 6 * UNEXPECTED BEHAVIOUR */<|endoftext|>
public open class WriteContext(public val strings: StringTable, public val contextExtensions: List<WriteContextExtension> = emptyList()) { internal val versionRequirements: MutableVersionRequirementTable = MutableVersionRequirementTable() internal val extensions = MetadataExtensions.INSTANCES public operator fun get(string: String): Int = strings.getStringIndex(string)
internal fun getClassName(name: ClassName): Int = strings.getClassNameIndex(name) } private fun WriteContext.writeTypeParameter(kmTypeParameter: KmTypeParameter): ProtoBuf.TypeParameter.Builder { val t = ProtoBuf.TypeParameter.newBuilder() kmTypeParameter.upperBounds.forEach { ub -><|endoftext|>
// EXPECTED_REACHABLE_NODES: 1283 package foo // CHECK_CONTAINS_NO_CALLS: test except=Unit_getInstance internal fun test(a: Int, b: Int): Int { var res = 0 with (a + b) { val t = this repeat(t) { res += t - b } }
return res } fun box(): String { assertEquals(10, test(2, 3)) assertEquals(15, test(3, 2)) return "OK" }<|endoftext|>
inline fun <reified T> testIdenticalReifiedTypeParameterB(arg: T) {} @Deprecated(message = "", level = DeprecationLevel.HIDDEN) inline fun <reified T> testIdenticalReifiedTypeParameterC(arg: Invariant<T>) {} inline fun <reified T> testIdenticalReifiedTypeParameterC(arg: Invariant<T>) {}
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) inline fun <reified T> testDifferencesInReifiedBehaviorOfTypeParameterA() {} inline fun <T> testDifferencesInReifiedBehaviorOfTypeParameterA() {} inline fun <reified T> testDifferencesInReifiedBehaviorOfTypeParameterAReverse() {}<|endoftext|>
if ((-1).toByte() in 1..<3 != range0.contains((-1).toByte())) throw AssertionError() if ((-1).toByte() !in 1..<3 != !range0.contains((-1).toByte())) throw AssertionError()
if (!((-1).toByte() in 1..<3) != !range0.contains((-1).toByte())) throw AssertionError() if (!((-1).toByte() !in 1..<3) != range0.contains((-1).toByte())) throw AssertionError() // no local optimizations<|endoftext|>
class Holder(val p: Plain, val w: WithNames) @OptIn(InternalSerializationApi::class) fun testSerializers(): String { val cs = (Holder.serializer() as GeneratedSerializer<*>).childSerializers() val str1 = cs[0].toString()
if (!str1.contains("kotlinx.serialization.internal.EnumSerializer")) return str1 /** * Serialization 1.5.0+ have runtime factories to create EnumSerializer instead of synthetic $serializer, saving bytecode * and bringing consistency. */ // val str2 = cs[1].toString()<|endoftext|>
val sb = kotlin.text.StringBuilder() sb.append(maybeStr) return sb.toString() } // CHECK-LABEL: define %struct.ObjHeader* @"kfun:codegen.stringConcatenationTypeNarrowing.kt53119_append_manual#appendString(kotlin.String)
// CHECK-OPT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append(kotlin.String?) // CHECK-OPT-NOT: %struct.ObjHeader* @"kfun:kotlin.text.StringBuilder#append<|endoftext|>
containsMultipleNonSubsumed: Boolean, ): FirPropertySymbol { return createIntersectionOverrideVariable<FirPropertySymbol, _>( mostSpecific, overrides, containsMultipleNonSubsumed, ::FirIntersectionOverridePropertySymbol, ) { symbol, fir, deferredReturnTypeCalculation, returnType ->
// Only setters's visibilities are calculated properly, because // getters' visibilities must be the same as the ones of their // properties and those we've already calculated. val setters = nonSubsumedNonPhantomOverrides.mapNotNull { (it as? FirPropertySymbol)?.unwrapSubstitutionOverrides()?.setterSymbol }<|endoftext|>
val isRoot: Boolean get() = parent == null init { parent?.children?.add(this) } } private abstract inner class VariableRenamer { abstract fun computeInlineScopeInfo(node: InlineScopeNode) abstract fun LocalVariableNode.belongsToInlineScope(node: InlineScopeNode): Boolean
open fun shouldSkipVariable(variable: LocalVariableNode): Boolean = false open fun inlineNesting(): Int = -1 fun renameVariables(methodNode: MethodNode): Int { val rootNode = computeInlineScopesTree(methodNode) return renameVariables(rootNode) } private fun computeInlineScopesTree(methodNode: MethodNode): InlineScopeNode {<|endoftext|>
override fun getAttributes(): AttributeContainer = attributeContainer @Deprecated("Scheduled for removal with Kotlin 2.2") override var useDisambiguationClassifierAsSourceSetNamePrefix: Boolean = true internal set @Deprecated("Scheduled for removal with Kotlin 2.2") override var overrideDisambiguationClassifierOnIdeImport: String? = null
internal set override val apiElementsConfigurationName: String get() = disambiguateName("apiElements") override val runtimeElementsConfigurationName: String get() = disambiguateName("runtimeElements") override val sourcesElementsConfigurationName: String get() = disambiguateName("sourcesElements")<|endoftext|>
floatArrayOf(Float.MAX_VALUE, Float.POSITIVE_INFINITY, 3.4028233E38f), floatArrayOf(-Float.MAX_VALUE, -3.4028233E38f, Float.NEGATIVE_INFINITY), floatArrayOf(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.MAX_VALUE),
floatArrayOf(Float.NEGATIVE_INFINITY, -Float.MAX_VALUE, Float.NEGATIVE_INFINITY)) } }<|endoftext|>
// WITH_STDLIB // IGNORE_BACKEND: JVM // LANGUAGE: +InlineClassImplementationByDelegation, +GenericInlineClassParameter interface I { fun ok(): String = "OK" } inline class IC<T: I>(val i: T): I by i fun box(): String { val i = object : I {}
var res = IC(i).ok() if (res != "OK") return "FAIL: $res" val ic: I = IC(i) res = ic.ok() return res }<|endoftext|>
* Returns the array element at the given [index]. This method can be called using the index operator. * * If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException]. */ public operator fun get(index: Int): Long { rangeCheck(index, storage.len()) return storage.get(index) } /**
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator. * * If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException]. */ public operator fun set(index: Int, value: Long) { rangeCheck(index, storage.len()) storage.set(index, value) }<|endoftext|>
fun case_6(x: Any?) { if (<!SENSELESS_COMPARISON!>x is Int == null<!>) { <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>inv<!>() <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!><!UNSAFE_CALL!>.<!>propAny<|endoftext|>
package org.jetbrains.kotlin.ant import org.apache.tools.ant.AntClassLoader import org.apache.tools.ant.Task import org.jetbrains.kotlin.preloading.ClassPreloadingUtils import org.jetbrains.kotlin.preloading.Preloader import java.io.File import java.lang.ref.SoftReference
import java.net.JarURLConnection internal object KotlinAntTaskUtil { private var classLoaderRef = SoftReference<ClassLoader?>(null) private val libPath: File by lazy { // Find path of kotlin-ant.jar in the filesystem and find kotlin-compiler.jar in the same directory<|endoftext|>
|| AsmUtil.CAPTURED_RECEIVER_FIELD == fieldName } internal fun isReturnOpcode(opcode: Int) = opcode >= Opcodes.IRETURN && opcode <= Opcodes.RETURN //marked return could be either non-local or local in case of labeled lambda self-returns
internal fun isMarkedReturn(returnIns: AbstractInsnNode) = getMarkedReturnLabelOrNull(returnIns) != null internal fun getMarkedReturnLabelOrNull(returnInsn: AbstractInsnNode): String? { if (!isReturnOpcode(returnInsn.opcode)) { return null } val previous = returnInsn.previous<|endoftext|>
0xbff921fb54442d18UL, 0xc01921fb54442d18UL, 0xbfe921fb54442d18UL, 0xc02921fb54442d18UL, ) @Test fun testSin() { val answers = arrayOf(
0x7ff8000000000000UL, 0x7ff8000000000000UL, 0x1UL, 0x3f7452fc98b34e97UL, 0x7ff8000000000000UL, 0x3fedcf338109c34bUL, 0x0UL, 0x3da5fd7fe1796495UL,<|endoftext|>
relevantFlags.add(FUN_INTERFACE) relevantFlags.add(INTERFACE_MODALITY) } val additionalModifiers = when (classKind) { ProtoBuf.Class.Kind.ENUM_CLASS -> listOf(KtTokens.ENUM_KEYWORD)
ProtoBuf.Class.Kind.COMPANION_OBJECT -> listOf(KtTokens.COMPANION_KEYWORD) ProtoBuf.Class.Kind.ANNOTATION_CLASS -> listOf(KtTokens.ANNOTATION_KEYWORD) else -> listOf<KtModifierKeywordToken>() }<|endoftext|>
val d = <!INVALID_IF_AS_EXPRESSION!>if<!> (true) true else; val e = if (true) <!IMPLICIT_CAST_TO_ANY!>{}<!> else <!IMPLICIT_CAST_TO_ANY!>false<!>
val f = if (true) <!IMPLICIT_CAST_TO_ANY!>true<!> else <!IMPLICIT_CAST_TO_ANY!>{}<!> { if (true) true }(); { if (true) true else false }(); { if (true) {} else false }(); {<|endoftext|>
internal fun externalNativeRuntimeFunction( name: String, returnType: LlvmRetType, parameterTypes: List<LlvmParamType> = emptyList(), functionAttributes: List<LlvmFunctionAttribute> = emptyList(), isVararg: Boolean = false ) = externalFunction(
LlvmFunctionSignature(returnType, parameterTypes, isVararg, functionAttributes).toProto( name, origin = FunctionOrigin.FromNativeRuntime, linkage = LLVMLinkage.LLVMExternalLinkage, independent = false ) ) internal fun externalNativeRuntimeFunction(name: String, signature: LlvmFunctionSignature) =<|endoftext|>
assertEquals(emptyList(), emptySequence<Int>().drop(1).toList()) listOf(2, 3, 4, 5).let { assertEquals(it, it.asSequence().drop(0).toList()) }
assertEquals("13, 21, 34, 55, 89, 144, 233, 377, 610, 987, ...", fibonacci().drop(7).joinToString(limit = 10)) assertEquals("13, 21, 34, 55, 89, 144, 233, 377, 610, 987, ...", fibonacci().drop(3).drop(4).joinToString(limit = 10))<|endoftext|>
assertEquals(expectedStatus, consumer.status) return HierarchicalCommonizationResult( inlineSourceTestFactory = DependencyAwareInlineSourceTestFactory(inlineSourceBuilder, testParameters.dependencies), testParameters = testParameters, commonizerParameters = commonizerParameters, results = consumer.modulesByTargets.mapValues { (_, collection) -> collection.toList() } ) }
private fun Parameters.toCommonizerParameters( resultsConsumer: ResultsConsumer, manifestDataProvider: (CommonizerTarget) -> NativeManifestDataProvider = { MockNativeManifestDataProvider(it) }, ): CommonizerParameters { return CommonizerParameters( outputTargets = outputTargets, manifestProvider = TargetDependent(outputTargets, manifestDataProvider),<|endoftext|>
class MessageManager4 : Manager<Message1> { override fun <T : Message1> execute1(task: Task<T>) {} override fun <T : Int> execute2(task: T) {} override fun <T : Message2> execute3() {} } class MessageManager5 : Manager<Message3> { override fun <T : Message3> execute4() {} }
class MessageManager6 : Manager<Message4> { override fun <T : Message4> execute5() {} } interface MessageManager7 : Manager<Message4> { override fun <T : Message4> execute5() {} } interface MessageManager8 : Manager<Message1> { override fun <T : Message1> execute1(task: Task<T>) {}<|endoftext|>
KotlinToolingVersion("1.7").isPreRelease ) assertTrue( KotlinToolingVersion("1.7.0-rc").isRC ) assertTrue( KotlinToolingVersion("1.7.0-beta").isBeta ) assertTrue( KotlinToolingVersion("1.7.0-alpha").isAlpha
) assertTrue( KotlinToolingVersion("1.7.0-m1").isMilestone ) assertTrue( KotlinToolingVersion("1.7.0-dev").isDev ) assertTrue( KotlinToolingVersion("1.7.0-snapshot").isSnapshot ) }<|endoftext|>
} override fun hasNext(): Boolean { return currentLine != null } override fun next(): String { val res = currentLine ?: throw NoSuchElementException() advance() return res } } private fun parseStratum(mappingInfo: String, stratum: String, callSites: SMAP?): SMAP? {
val fileMappings = linkedMapOf<Int, FileMapping>() val iterator = SMAPTokenizer(mappingInfo, "${SMAP.STRATA_SECTION} $stratum") // JSR-045 allows the line section to come before the file section, but we don't generate SMAPs like this.<|endoftext|>
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException]. */ @GCUnsafeCall("Kotlin_DoubleArray_get") public external operator fun get(index: Int): Double /** * Sets the element at the given [index] to the given [value]. This method can be called using the index operator. *
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException]. */ @GCUnsafeCall("Kotlin_DoubleArray_set") public external operator fun set(index: Int, value: Double): Unit @GCUnsafeCall("Kotlin_DoubleArray_getArrayLength") private external fun getArrayLength(): Int<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.funNullableT() <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.funNullableAny() } } // TESTCASE NUMBER: 9
fun <T>case_9(x: MutableMap<T, out T>) = select(x.values.first(), x.keys.first()) fun case_9() { val x = case_9(mutableMapOf(null to 10)) if (x != null) {<|endoftext|>
package org.jetbrains.kotlin.fir.resolve.transformers.mpp import org.jetbrains.kotlin.fir.FirExpectActualMatchingContext import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.ExpectForActualMatchingData
import org.jetbrains.kotlin.fir.declarations.expectForActual import org.jetbrains.kotlin.fir.declarations.fullyExpandedClass import org.jetbrains.kotlin.fir.declarations.utils.isExpect import org.jetbrains.kotlin.fir.resolve.providers.dependenciesSymbolProvider<|endoftext|>
// "&rlarr;" to 8644, // "&rlhar;" to 8652, // "&rlm;" to 8207, // "&rmoustache;" to 9137, // "&rmoust;" to 9137, // "&rnmid;" to 10990, // "&roang;" to 10221, // "&roarr;" to 8702,
// "&robrk;" to 10215, // "&ropar;" to 10630, // "&ropf;" to 120163, // "&Ropf;" to 8477, // "&roplus;" to 10798, // "&rotimes;" to 10805, // "&RoundImplies;" to 10608, // "&rpar;" to 41,<|endoftext|>
FqName("edu.umd.cs.findbugs.annotations.PossiblyNull"), FqName("edu.umd.cs.findbugs.annotations.CheckForNull"), // RxJava FqName("io.reactivex.annotations.Nullable"), FqName("io.reactivex.rxjava3.annotations.Nullable"), // Eclipse JDT
FqName("org.eclipse.jdt.annotation.Nullable"), ) val FORCE_FLEXIBILITY_ANNOTATIONS: Set<FqName> = setOf( // JSpecify JSPECIFY_OLD_NULLNESS_UNSPECIFIED_ANNOTATION_FQ_NAME,<|endoftext|>
* Splits the [input] CharSequence to a list of strings around matches of this regular expression. * * @param limit Non-negative value specifying the maximum number of substrings the string can be split to. * Zero by default means no limit is set. */ public fun split(input: CharSequence, limit: Int = 0): List<String> /**
* Splits the [input] CharSequence to a sequence of strings around matches of this regular expression. * * @param limit Non-negative value specifying the maximum number of substrings the string can be split to. * Zero by default means no limit is set. * @sample samples.text.Regexps.splitToSequence */ @SinceKotlin("1.6")<|endoftext|>
// WITH_STDLIB // WORKS_WHEN_VALUE_CLASS // LANGUAGE: +ValueClasses OPTIONAL_JVM_INLINE_ANNOTATION value class S1(val s1: String) OPTIONAL_JVM_INLINE_ANNOTATION value class S2(val s2: String) object X1 object X2
fun <T> test(s1: S1, x: T) { if (s1.s1 != "OK" && x != X1) throw AssertionError() } fun <T> test(s2: S2, x: T) { if (s2.s2 != "OK" && x != X2) throw AssertionError() } fun box(): String {<|endoftext|>
override fun lower(irBody: IrBody, container: IrDeclaration) { if (!context.propertyLazyInitialization.enabled) { return } if (container !is IrField && container !is IrSimpleFunction && container !is IrProperty) return if (!container.isCompatibleDeclaration(context)) return val file = container.parent as? IrFile
?: return val initFun = (when { file in fileToInitializationFuns -> fileToInitializationFuns[file] fileToInitializerPureness[file] == true -> null else -> { createInitializationFunction(file).also { fileToInitializationFuns[file] = it } } }) ?: return<|endoftext|>
if (missingClasses.isNotEmpty()) { val presentClasses = className.trim() className = buildString { append(presentClasses) if (!presentClasses.isEmpty()) { append(" ") } missingClasses.joinTo(this, " ") } return true } return false } /**
* Removes all [cssClasses] from element. Has no effect if all specified classes are missing in class attribute of the element * * @return true if at least one class has been removed */ @SinceKotlin("1.4") public fun Element.removeClass(vararg cssClasses: String): Boolean { if (cssClasses.any { hasClass(it) }) {<|endoftext|>
is KtClassOrObject -> contextReceivers else -> emptyList() } return contextReceivers.isNotEmpty() } fun KtClassOrObject.isObjectLiteral(): Boolean = this is KtObjectDeclaration && isObjectLiteral() //TODO: strange method, and not only Kotlin specific (also Java) fun PsiElement.parameterIndex(): Int {
val parent = parent return when { this is KtParameter && parent is KtParameterList -> parent.parameters.indexOf(this) this is PsiParameter && parent is PsiParameterList -> parent.getParameterIndex(this) else -> -1 } }<|endoftext|>
if (this.x != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char? & kotlin.Char")!>x<!>.equals(null) if (this.x != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char? & kotlin.Char")!>x<!>.propT
if (this.x != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char? & kotlin.Char")!>x<!>.propAny if (this.x != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char? & kotlin.Char")!>x<!>.propNullableT<|endoftext|>
// To avoid hassle with generic type parameters, we pretend that PropertyReferenceN.get takes and returns `Any?` // (similarly with set). This should be enough for the JVM IR backend to generate correct calls and bridges. klass.addFunction("get", irBuiltIns.anyNType, Modality.ABSTRACT).apply { for (i in 0 until parameterCount) {
addValueParameter("receiver$i", irBuiltIns.anyNType) } } // invoke redirects to get klass.addFunction("invoke", irBuiltIns.anyNType, Modality.FINAL).apply { for (i in 0 until parameterCount) { addValueParameter("receiver$i", irBuiltIns.anyNType) } }<|endoftext|>
override fun write(v: ByteWriter) { if (v !is OutputStream || v.os !is ByteArrayOutputStream) error("Writer not created from createTemp") v.os.writeTo(os) written += v.os.size() } override fun writeByte(v: Byte) { os.write(v.toInt()) written++ }
override fun writeBytes(v: ByteArray) { os.write(v) written += v.size } override fun createTemp() = OutputStream(ByteArrayOutputStream()) } } private class SourceLocationMappingToBinary( override val sourceLocation: SourceLocation,<|endoftext|>
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T: UserInterfaceB> testTypeParameterWithMultipleDifferentUpperBoundsAC() where T: UserInterfaceA {} fun <T: UserInterfaceC> testTypeParameterWithMultipleDifferentUpperBoundsAC() where T: UserInterfaceA {}
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T> testTypeParameterWithMultipleDifferentUpperBoundsBA() where T: UserInterfaceA, T: UserInterfaceB {} fun <T> testTypeParameterWithMultipleDifferentUpperBoundsBA() where T: UserInterfaceC, T: UserInterfaceD {}<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("otherpackage.Case13 & otherpackage.Case13?"), DEBUG_INFO_SMARTCAST!>x<!>.funAny() <!DEBUG_INFO_EXPRESSION_TYPE("otherpackage.Case13 & otherpackage.Case13?")!>x<!>.funNullableT()
<!DEBUG_INFO_EXPRESSION_TYPE("otherpackage.Case13 & otherpackage.Case13?")!>x<!>.funNullableAny() } // TESTCASE NUMBER: 14 class Case14 { val x: otherpackage.Case14<!REDUNDANT_NULLABLE!>?<!> init { x = otherpackage.Case14() } }<|endoftext|>
import org.jetbrains.kotlin.kapt3.util.isJvmOverloadsGenerated import org.jetbrains.kotlin.kapt3.util.isStatic import org.jetbrains.org.objectweb.asm.Type import org.jetbrains.org.objectweb.asm.tree.AnnotationNode import org.jetbrains.org.objectweb.asm.tree.ClassNode
import org.jetbrains.org.objectweb.asm.tree.MethodNode internal class ParameterInfo( val flags: Long, val name: String, val type: Type, val visibleAnnotations: List<AnnotationNode>?, val invisibleAnnotations: List<AnnotationNode>? ) internal fun MethodNode.getParametersInfo( containingClass: ClassNode,<|endoftext|>
abstract fun String.o(): String override fun o(): String { return "O".o() } } // FILE: exported.kt @file:JsExport class Baz : Bar() { override fun String.o(): String { return this } } // FILE: test.js function Foo() {} Foo.prototype.k = function() {
return "K" } function box() { return test(new this["lib"].Baz()); } function test(foo) { const oStable = foo.oStable("OK") if (oStable !== "OK") return "false: " + oStable return foo.o() + foo.k() }<|endoftext|>
// library.kt:13 box: mainVar:int=1:int, fooParam\13:int=1:int, $i$f$foo\13\54:int=0:int, fooVar\13:int=1:int, fooLambdaParam\21:int=1:int, $i$a$-foo-TestKt$box$1\21\234\0:int=0:int,
fooLamdbdaVar\21:int=2:int, barParam\22:int=2:int, $i$f$bar\22\56:int=0:int, barVar\22:int=2:int<|endoftext|>
public class Test<T extends Object, E extends @Nullable Object, F extends @NullnessUnspecified Object> { } // FILE: main.kt fun main( aNotNullNotNullNotNull: Test<Derived, Derived, Derived>, aNotNullNotNullNull: Test<Derived, Derived, Derived?>,
aNotNullNullNotNull: Test<Derived, Derived?, Derived>, aNotNullNullNull: Test<Derived, Derived?, Derived?>, aAnyNotNullNotNullNotNull: Test<Any, Any, Any>, aAnyNotNullNotNullNull: Test<Any, Any, Any?>, aAnyNotNullNullNotNull: Test<Any, Any?, Any>,<|endoftext|>
public operator fun <T> kotlin.collections.Set<T>.plus(elements: kotlin.sequences.Sequence<T>): kotlin.collections.Set<T> @kotlin.internal.InlineOnly public inline operator fun <T> kotlin.collections.MutableCollection<in T>.plusAssign(element: T): kotlin.Unit
@kotlin.internal.InlineOnly public inline operator fun <T> kotlin.collections.MutableCollection<in T>.plusAssign(elements: kotlin.Array<T>): kotlin.Unit @kotlin.internal.InlineOnly<|endoftext|>
// WITH_STDLIB // WORKS_WHEN_VALUE_CLASS // LANGUAGE: +ValueClasses, +GenericInlineClassParameter OPTIONAL_JVM_INLINE_ANNOTATION value class Foo<T: Int>(val arg: T) OPTIONAL_JVM_INLINE_ANNOTATION value class AsAny<T: Any>(val arg: T)
fun box(): String { val arr = arrayOf(Foo(1), Foo(2)) var sum = 0 for (el in arr) { sum += el.arg } if (sum != 3) return "Fail 1" sum = 0 for (el in arrayOf(AsAny(42), AsAny(1))) { sum += el.arg as Int }<|endoftext|>
val symbol = annotationTypeRef.coneType.fullyExpandedType(session).toSymbol(session) as? FirRegularClassSymbol ?: return null val constructorSymbol = symbol.unsubstitutedScope(c).getDeclaredConstructors().firstOrNull() ?: return null val argumentToParameterToMapping = constructorSymbol.valueParameterSymbols.mapNotNull {
val parameter = it.fir val argument = this@toAnnotationCall.argumentMapping.mapping[parameter.name] ?: return@mapNotNull null argument to parameter }.toMap(LinkedHashMap()) argumentList = buildResolvedArgumentList(original = null, argumentToParameterToMapping) calleeReference = buildResolvedNamedReference {<|endoftext|>
import org.jetbrains.kotlin.test.frontend.fir.FirOutputArtifact object FrontendKinds { object ClassicFrontend : FrontendKind<ClassicFrontendOutputArtifact>("ClassicFrontend") object FIR : FrontendKind<FirOutputArtifact>("FIR") object ClassicAndFIR : FrontendKind<K1AndK2OutputArtifact>("ClassicAndFIR")
fun fromString(string: String): FrontendKind<*>? { return when (string) { "ClassicFrontend" -> ClassicFrontend "FIR" -> FIR "ClassicAndFIR" -> ClassicAndFIR else -> null } } } val FrontendKind<*>.isFir: Boolean get() = this == FrontendKinds.FIR<|endoftext|>
class AndroidTransformingPreprocessor(testServices: TestServices) : SourceFilePreprocessor(testServices) { override fun process(file: TestFile, content: String): String { val transformers = Android.forAll + (Android.forSpecificFile[file.originalFile]?.let { listOf(it) } ?: emptyList())
return transformers.fold(content) { text, transformer -> transformer(text) } } } useSourcePreprocessor({ AndroidTransformingPreprocessor(it) }) } companion object { const val GRADLE_VERSION = "6.8.1" // update GRADLE_SHA_256 on change<|endoftext|>
if (!(element21 in 1..<3) != !range0.contains(element21)) throw AssertionError() if (!(element21 !in 1..<3) != range0.contains(element21)) throw AssertionError() } fun testR0xE22() { // with possible local optimizations
if (4 in 1..<3 != range0.contains(4)) throw AssertionError() if (4 !in 1..<3 != !range0.contains(4)) throw AssertionError() if (!(4 in 1..<3) != !range0.contains(4)) throw AssertionError()<|endoftext|>
val typeByDeclaration = typeForQualifierByDeclaration(declaration, components.session, element = this, components.file) if (typeByDeclaration != null) { this.resultType = typeByDeclaration replaceCanBeValue(true) return } } } this.resultType = components.session.builtinTypes.unitType.type }
internal fun typeForReifiedParameterReference(parameterReferenceBuilder: FirResolvedReifiedParameterReferenceBuilder): ConeLookupTagBasedType { val typeParameterSymbol = parameterReferenceBuilder.symbol return typeParameterSymbol.constructType(emptyArray(), false) } internal fun typeForQualifierByDeclaration( declaration: FirDeclaration, session: FirSession, element: FirElement, file: FirFile<|endoftext|>
import org.jetbrains.kotlin.cli.common.messages.FilteringMessageCollector import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.cli.jvm.config.configureJdkClasspathRoots import org.jetbrains.kotlin.config.* import org.jetbrains.kotlin.incremental.ClasspathChanges.ClasspathSnapshotDisabled<|endoftext|>
fun testEmulatedScalaStdlibSyntheticMethodLoading() { // #KT-38325 and #KT-39799 val classFqn = "org/jetbrains/kotlin/compiler/test/GeneratedScalalikeTraversableOncePart" val classNode = ClassNode(Opcodes.API_VERSION).apply { version = Opcodes.V1_6
access = Opcodes.ACC_PUBLIC name = classFqn signature = "L$classFqn;" superName = "java/lang/Object" methods.add( // The root of the problem described in the #KT-38325 and #KT-39799 is the presence of a method with signature and descriptor<|endoftext|>
val parameters = symbol?.typeParameterSymbols ?: continue if (visitedSymbols.add(symbol)) { parameters.forEach { visit(it.toConeType()) } } if (parameters.size != type.typeArguments.size) continue for (i in parameters.indices) {
if (type.typeArguments[i].kind != ProjectionKind.INVARIANT) { val parameter = parameters[i].toConeType() edges.getOrPut(coneType) { mutableSetOf() }.add(parameter) edges.getOrPut(parameter) { mutableSetOf() } } } } }<|endoftext|>
private external fun kniBridge55(p0: NativePtr): NativePtr private external fun kniBridge56(p0: NativePtr): Unit private external fun kniBridge57(p0: NativePtr, p1: Int, p2: NativePtr): Unit private external fun kniBridge58(): Int private external fun kniBridge59(p0: NativePtr): Int
private external fun kniBridge60(p0: NativePtr, p1: NativePtr): Unit private external fun kniBridge61(p0: NativePtr, p1: NativePtr): Unit private external fun kniBridge62(p0: NativePtr, p1: NativePtr, p2: NativePtr): Unit private external fun kniBridge63(p0: NativePtr): Int<|endoftext|>
protected abstract fun isEnabled(element: KtElement?): Boolean protected abstract fun isExperimental(element: KtElement?): Boolean protected abstract fun getGlobalCacheImpl(element: KtElement?): CacheImplementation private fun ContainerOptionsProxy.getCacheOrDefault(element: KtElement?) = this.cache ?: getGlobalCacheImpl(element)
override fun applyProperty(receiver: StackValue, resolvedCall: ResolvedCall<*>, c: ExpressionCodegenExtension.Context): StackValue? { val resultingDescriptor = resolvedCall.resultingDescriptor return if (resultingDescriptor is PropertyDescriptor) { return generateResourcePropertyCall(receiver, resolvedCall, c, resultingDescriptor) } else null<|endoftext|>
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(value_2?.<!UNRESOLVED_REFERENCE!>toByte<!>()) } if (funWithReturnsFalseAndInvertCondition(value_1 is String && value_2 is Number)) {
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(value_1.<!UNRESOLVED_REFERENCE!>length<!>) <!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(value_2.<!UNRESOLVED_REFERENCE!>toByte<!>()) }<|endoftext|>
OperatorNameConventions.EQUALS, Checks.member, object : Check() { override fun check(function: FirSimpleFunction, session: FirSession, scopeSession: ScopeSession?): String? { if (scopeSession == null) return null val containingClassSymbol = function.containingClassLookupTag()?.toFirRegularClassSymbol(session) ?: return null
val customEqualsSupported = session.languageVersionSettings.supportsFeature(LanguageFeature.CustomEqualsInValueClasses) if (function.symbol.overriddenFunctions(containingClassSymbol, session, scopeSession) .any { it.containingClassLookupTag()?.classId == StandardClassIds.Any }<|endoftext|>
private val REGULAR_ARGUMENT_NAMES = FactoryMap.create<Int, CirName> { index -> CirName.create(REGULAR_ARGUMENT_PREFIX + index) } private fun CirCallableMemberWithParameters.canNamesBeOverwritten(): Boolean {
return (this as CirHasAnnotations).annotations.none { it.type.classifierId.isObjCInteropCallableAnnotation } } private fun failIllegalState(current: ValueParameterNames?, next: ValueParameterNames): Nothing = throw IllegalCommonizerStateException("unexpected next state $next with current state $current") } }<|endoftext|>
true -> factory.deprecationWarning false -> factory }.on(property) ) } private val DiagnosticFactory0<KtProperty>.deprecationWarning: DiagnosticFactory0<KtProperty> get() = when (this) { MUST_BE_INITIALIZED -> MUST_BE_INITIALIZED_WARNING
MUST_BE_INITIALIZED_OR_BE_ABSTRACT -> MUST_BE_INITIALIZED_OR_BE_ABSTRACT_WARNING MUST_BE_INITIALIZED_OR_BE_FINAL -> MUST_BE_INITIALIZED_OR_BE_FINAL_WARNING<|endoftext|>
val builtInsPlatform = libraryManifest.platform?.let(BuiltInsPlatform::parseFromString) ?: error("Unknown platform: ${libraryManifest.platform}") val libraryFile = buildDir.resolve("$libraryName.klib") val libraryKFile = KFile(libraryFile.absolutePath) val libraryLayout = KotlinLibraryLayoutForWriter(libraryKFile, libraryKFile)
val library = KotlinLibraryWriterImpl( moduleName = libraryName, versions = libraryVersioning, builtInsPlatform = builtInsPlatform, nativeTargets = libraryManifest.platformTargets.filterIsInstance<LibraryTarget.Native>().map { it.name }, nopack = true, shortName = libraryName, layout = libraryLayout )<|endoftext|>
class C2: <!MIXING_SUSPEND_AND_NON_SUSPEND_SUPERTYPES!>SFISuper, FISuper<!> { override suspend fun invoke() { } }
fun interface FI2: <!MIXING_SUSPEND_AND_NON_SUSPEND_SUPERTYPES!>SFISuper, FISuper<!> { } interface I2: <!MIXING_SUSPEND_AND_NON_SUSPEND_SUPERTYPES!>SFISuper, FISuper<!> { }<|endoftext|>
// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses class Val { operator fun getValue(thisRef: Any?, kProp: Any?) = 1 } class Var { operator fun getValue(thisRef: Any?, kProp: Any?) = 2 operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {} }
object ValObject { operator fun getValue(thisRef: Any?, kProp: Any?) = 1 } object VarObject { operator fun getValue(thisRef: Any?, kProp: Any?) = 2 operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {} } inline class Z(val data: Int) {<|endoftext|>
internal class DaemonCompilationResults(private val kotlinLogger: KotlinLogger, private val rootProjectDir: File?) : CompilationResults, UnicastRemoteObject( SOCKET_ANY_FREE_PORT, LoopbackNetworkInterface.clientLoopbackSocketFactory, LoopbackNetworkInterface.serverLoopbackSocketFactory ) { /** * Possible combinations:
* 1. [CompilationResultCategory.IC_COMPILE_ITERATION.code] -> a [CompileIterationResult] instance * 2. [CompilationResultCategory.BUILD_REPORT_LINES.code] -> a [List] of [String]<|endoftext|>
package org.jetbrains.kotlin.ir.backend.js.lower import org.jetbrains.kotlin.backend.common.BodyLoweringPass import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder import org.jetbrains.kotlin.ir.backend.js.utils.Namer<|endoftext|>
};") }
/** * Exposes the JavaScript [EventSource](https://developer.mozilla.org/en/docs/Web/API/EventSource) to Kotlin */ public external open class EventSource(url: String, eventSourceInitDict: EventSourceInit = definedExternally) : EventTarget, JsAny { open val url: String open val withCredentials: Boolean open val readyState: Short<|endoftext|>
script, this@SymbolLightClassForScript, METHOD_INDEX_FOR_SCRIPT_MAIN ) add(mainMethod) } override fun getOwnMethods(): List<KtLightMethod> = cachedValue { val result = mutableListOf<KtLightMethod>() result.addScriptDefaultMethods()
symbolPointer.withSymbol(ktModule) { scriptSymbol -> createMethods(scriptSymbol.getDeclaredMemberScope().getCallableSymbols(), result) } result } override fun getOwnFields(): List<KtLightField> = cachedValue { buildList { symbolPointer.withSymbol(ktModule) { scriptSymbol -><|endoftext|>
if (4 !in emptyObjectArray.indices != !range3.contains(4)) throw AssertionError() if (!(4 in emptyObjectArray.indices) != !range3.contains(4)) throw AssertionError() if (!(4 !in emptyObjectArray.indices) != range3.contains(4)) throw AssertionError() // no local optimizations
if (element22 in emptyObjectArray.indices != range3.contains(element22)) throw AssertionError() if (element22 !in emptyObjectArray.indices != !range3.contains(element22)) throw AssertionError() if (!(element22 in emptyObjectArray.indices) != !range3.contains(element22)) throw AssertionError()<|endoftext|>
addFieldChange("Machine CPU", previousEnvironment.machine.cpu, currentEnvironment.machine.cpu) addFieldChange("Machine OS", previousEnvironment.machine.os, currentEnvironment.machine.os) addFieldChange("JDK version", previousEnvironment.jdk.version, currentEnvironment.jdk.version) addFieldChange("JDK vendor", previousEnvironment.jdk.vendor, currentEnvironment.jdk.vendor)
} } ?: listOf<FieldChange<String>>() } val kotlinChanges: List<FieldChange<String>> get() { val previousCompiler = compilers.second val currentCompiler = compilers.first return previousCompiler?.let { mutableListOf<FieldChange<String>>().apply {<|endoftext|>
// try decoding ASCII line separator to see if this charset (like UTF-8) encodes it directly byteBuf.clear() charBuf.clear() byteBuf.put('\n'.code.toByte()) byteBuf.flip() decoder.decode(byteBuf, charBuf, false)
directEOL = charBuf.position() == 1 && charBuf.get(0) == '\n' resetAll() } // Slow path -- only on exception in decoder and on charset change private fun resetAll() { decoder.reset() byteBuf.position(0) sb.setLength(0) }<|endoftext|>
import org.jetbrains.kotlin.storage.StorageManager import org.jetbrains.kotlin.utils.sure import java.util.ArrayList class CliDeclarationProviderFactoryService(private val sourceFiles: Collection<KtFile>) : DeclarationProviderFactoryService() { override fun create( project: Project, storageManager: StorageManager,
syntheticFiles: Collection<KtFile>, filesScope: GlobalSearchScope, moduleInfo: ModuleInfo ): DeclarationProviderFactory { val allFiles = ArrayList<KtFile>() sourceFiles.filterTo(allFiles) { val vFile = it.virtualFile.sure { "Source files should be physical files" } filesScope.contains(vFile) }<|endoftext|>
} JsAstProtoBuf.Expression.ExpressionCase.BINARY -> { val binaryProto = proto.binary JsBinaryOperation(map(binaryProto.type), deserialize(binaryProto.left), deserialize(binaryProto.right)) } JsAstProtoBuf.Expression.ExpressionCase.UNARY -> {
val unaryProto = proto.unary val type = map(unaryProto.type) val operand = deserialize(unaryProto.operand) if (unaryProto.postfix) JsPostfixOperation(type, operand) else JsPrefixOperation(type, operand) }<|endoftext|>
private fun MutableMap<IrSymbol, IrCallTransformer>.postfixOp(function: IrSimpleFunctionSymbol, op: JsUnaryOperator) { withTranslatedArgs(function) { JsPostfixOperation(op, it[0]) } } private inline fun MutableMap<IrSymbol, IrCallTransformer>.withTranslatedArgs( function: IrSimpleFunctionSymbol,
crossinline t: (List<JsExpression>) -> JsExpression ) { put(function) { call, context -> t(translateCallArguments(call, context)) } }<|endoftext|>
} else if (insn1.opcode == Opcodes.DUP) { val insn2 = insn1.previous ?: continue if (insn2.opcode == Opcodes.ALOAD) { aLoadInsn = insn2 as VarInsnNode } } if (aLoadInsn == null) continue
addDependentCheck(insn, aLoadInsn) } } } } private fun addDependentCheckForCheckNotNull(insn: AbstractInsnNode, checkedValueInsn: AbstractInsnNode) { val aLoadInsn = if (checkedValueInsn.opcode == Opcodes.DUP) { checkedValueInsn.previous ?: return<|endoftext|>
import org.jetbrains.kotlin.context.ProjectContext import org.jetbrains.kotlin.descriptors.PackageFragmentProvider import org.jetbrains.kotlin.descriptors.impl.ModuleDependenciesImpl import org.jetbrains.kotlin.descriptors.konan.isNativeStdlib
import org.jetbrains.kotlin.library.metadata.CurrentKlibModuleOrigin import org.jetbrains.kotlin.library.metadata.KlibMetadataFactories import org.jetbrains.kotlin.library.metadata.NullFlexibleTypeDeserializer import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtFile<|endoftext|>
KtUltraLightInlineClass(element, support) else -> KtUltraLightClass(element, support) } } fun createUltraLightClassForScript(script: KtScript): KtUltraLightClassForScript = KtUltraLightClassForScript(script, support = getUltraLightClassSupport(script)) companion object { @JvmStatic
fun getInstance(project: Project): LightClassGenerationSupport { return project.getService(LightClassGenerationSupport::class.java) } } }<|endoftext|>
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext import org.jetbrains.kotlin.ir.backend.js.ir.JsIrArithBuilder import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrDeclaration import org.jetbrains.kotlin.ir.declarations.IrDeclarationBase import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent import org.jetbrains.kotlin.ir.expressions.*<|endoftext|>
contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns(null) implies <!ARGUMENT_TYPE_MISMATCH!>listOf(0)<!><!> } return null } // TESTCASE NUMBER: 6 fun case_6(value_1: Boolean): Boolean? {
contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns(null) implies <!ARGUMENT_TYPE_MISMATCH!><!CONTRACT_NOT_ALLOWED!>contract<!> { returns(null) implies (!value_1) }<!><!> } return null } // TESTCASE NUMBER: 7 fun case_7(): Int {<|endoftext|>
if (a.s != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any"), DEBUG_INFO_SMARTCAST!>a.s<!>.funAny() if (a.s != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any?")!>a.s<!>.funNullableT()
if (a.s != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any?")!>a.s<!>.funNullableAny() if (a.s != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any?")!>a.s<!><|endoftext|>
override fun check(declaration: FirClass, context: CheckerContext, reporter: DiagnosticReporter) { if (!declaration.symbol.isEffectivelyExternal(context)) { declaration.forEachParents(context) { parent -> if (parent.hasAnnotation(JsExternalInheritorsOnly, context.session)) { reporter.reportOn( declaration.source,
FirJsErrors.JS_EXTERNAL_INHERITORS_ONLY, parent, declaration.symbol, context ) } } } } }<|endoftext|>
override fun visitFunction(declaration: IrFunction) { // Inline class constructors are currently empty if (declaration is IrConstructor && backendContext.inlineClassesUtils.isClassInlineLike(declaration.parentAsClass)) return val isIntrinsic = declaration.hasWasmNoOpCastAnnotation() || declaration.getWasmOpAnnotation() != null
if (isIntrinsic) { return } val wasmImportModule = declaration.getWasmImportDescriptor() val jsCode = declaration.getJsFunAnnotation() val importedName = when { wasmImportModule != null -> { check(declaration.isExternal) { "Non-external fun with @WasmImport ${declaration.fqNameWhenAvailable}"}<|endoftext|>
System.setProperty("KOTLIN_POWER_ASSERT_ADD_SRC_ROOTS", sourceRoots) defaultDirectives { +FULL_JDK +WITH_STDLIB } useDirectives(PowerAssertConfigurationDirectives) useConfigurators(::PowerAssertEnvironmentConfigurator) useAdditionalSourceProviders(
::AdditionalSourceFilesProvider, ) enableJunit() } class PowerAssertEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfigurator(testServices) { override fun CompilerPluginRegistrar.ExtensionStorage.registerCompilerExtensions( module: TestModule, configuration: CompilerConfiguration, ) {<|endoftext|>
compilationResolver.compilationNpmResolution.internalDependencies.map { dependency -> nodeJs.resolver[dependency.projectPath][dependency.compilationName].npmProject.packageJsonTaskPath } + compilationResolver.compilationNpmResolution.internalCompositeDependencies.map { dependency ->
dependency.includedBuild?.task(":$PACKAGE_JSON_UMBRELLA_TASK_NAME") ?: error("includedBuild instance is not available") dependency.includedBuild.task(":${RootPackageJsonTask.NAME}") } // ----- private val projectPath = project.path @get:Internal<|endoftext|>
import java.io.File private fun getLibraryJar(classToDetect: String): File? = try { PathUtil.getResourcePathForClass(Class.forName(classToDetect)) } catch (e: ClassNotFoundException) { null } class ParcelizeEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfigurator(testServices) {
override fun configureCompilerConfiguration(configuration: CompilerConfiguration, module: TestModule) { val libPath = PathUtil.kotlinPathsForCompiler.libPath val runtimeLibrary = File(libPath, PathUtil.PARCELIZE_RUNTIME_PLUGIN_JAR_NAME)<|endoftext|>
val resultingSubstitution = csBuilder.build().resultingSubstitutor.substitution for ((originalTypeVariable) in typeTemplates) { resultingSubstitution[originalTypeVariable.type]?.type.let { externalCSBuilder.addSubtypeConstraint(originalTypeVariable.type, it, ConstraintPositionKind.FROM_COMPLETER.position())
externalCSBuilder.addSubtypeConstraint(it, originalTypeVariable.type, ConstraintPositionKind.FROM_COMPLETER.position()) } } } fun badCallHappened() { hereIsBadCall = true } } class BuilderInferenceSupport( val argumentTypeResolver: ArgumentTypeResolver,<|endoftext|>
* [symbolProvider] for [FirProvider] may provide only symbols from sources of current module */ abstract val symbolProvider: FirSymbolProvider open val isPhasedFirAllowed: Boolean get() = false abstract fun getFirClassifierByFqName(classId: ClassId): FirClassLikeDeclaration?
abstract fun getFirClassifierContainerFile(fqName: ClassId): FirFile abstract fun getFirClassifierContainerFileIfAny(fqName: ClassId): FirFile? open fun getFirClassifierContainerFile(symbol: FirClassLikeSymbol<*>): FirFile = getFirClassifierContainerFile(symbol.classId)<|endoftext|>
// IGNORE_BACKEND: JS // FILE: 1.kt inline fun run(f: () -> Unit) = f() inline fun withAny(f: Any.() -> Unit) = Any().f() inline fun foo(x: Any?, y: Any?, f: () -> Unit) = f() // FILE: 2.kt fun box(): String { run outer@{ withAny inner@{
foo(null, 0 ?: return@outer) { foo(null, null ?: return@inner) {} } } } return "OK" }<|endoftext|>
val d: dynamic = C() assertEquals("C.foo(42)", d.foo(42)) assertEquals("C.foo(99)", d.bar(99)) val d2: dynamic = CDerived() assertEquals("CDerived.foo(42)", d2.foo(42)) assertEquals("CDerived.foo(99)", d2.bar(99))
val da: A = E() assertEquals("D.foo(55)", da.foo(55)) val db: B = E() assertEquals("D.foo(23)", db.foo(23)) val dd: dynamic = E() assertEquals("D.foo(42)", dd.foo(42))<|endoftext|>
fun fun_with_where() = fun <!TYPE_PARAMETERS_NOT_ALLOWED!><T><!> <!UNRESOLVED_REFERENCE!>T<!>.(t: <!UNRESOLVED_REFERENCE!>T<!>): <!UNRESOLVED_REFERENCE!>T<!> where T: A = null!! fun outer() {
devNull(fun <!TYPE_PARAMETERS_NOT_ALLOWED!><T><!>() {}) devNull(fun <!TYPE_PARAMETERS_NOT_ALLOWED!><T><!> <!UNRESOLVED_REFERENCE!>T<!>.() {})<|endoftext|>
override fun toString() = "$packageFqName/$declarationRelativeFqName" companion object { val IrDeclarationWithName.declarationId: DeclarationId? get() { return when (val parent = parent) { is IrPackageFragment -> DeclarationId(parent.packageFqName.asString(), name.asString())
is IrDeclarationWithName -> parent.declarationId?.createNested(name.asString()) else -> null } } } } /** * Check if the outermost lazy IR class containing [this] declaration is private. If it is, which normally should not happen * because the lazy IR declaration referenced from non-lazy IR is always expected to be exported from its module and thus<|endoftext|>
generateUnaryOperators() generateRangeTo() generateRangeUntil() if (type == UnsignedType.UINT || type == UnsignedType.ULONG) { generateBitShiftOperators() } generateBitwiseOperators() generateMemberConversions() generateFloatingConversions() generateToStringHashCode()
out.println("}") out.println() generateExtensionConversions() } private fun generateCompareTo() { for (otherType in UnsignedType.entries) { out.println(""" /** * Compares this value with the specified value for order.<|endoftext|>
ClassId(packageFqName, relativeClassName.parent(), isLocal = false).defaultType(outerTypeParameters) } resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES this.typeParameters += typeParameters.filterIsInstance<FirTypeParameter>() .map { buildConstructedClassTypeParameterRef { this.symbol = it.symbol } }
valueParameters += local.memberDeserializer.valueParameters( proto.valueParameterList, symbol, proto, AbstractAnnotationDeserializer.CallableKind.OTHERS, classProto, addDefaultValue = classBuilder.symbol.classId == StandardClassIds.Enum ) annotations +=<|endoftext|>
* DESCRIPTION: Contract is first statement in control flow terms, but not in tokens order terms. * ISSUES: KT-26153 * HELPERS: functions */ import kotlin.contracts.* // TESTCASE NUMBER: 1 inline fun case_1(block: () -> Unit) { return <!CONTRACT_NOT_ALLOWED!>contract<!> {
callsInPlace(<!USAGE_IS_NOT_INLINABLE!>block<!>, InvocationKind.EXACTLY_ONCE) } } // TESTCASE NUMBER: 2 fun case_2() = <!CONTRACT_NOT_ALLOWED!>contract<!> { } // TESTCASE NUMBER: 3<|endoftext|>
val metadataBinary = sourceSet.metadataBinary ?: fail("Missing metadataBinary for ${sourceSet.sourceSetName}") assertTrue(metadataBinary.copyTo(metadataFile), "Expected 'copyTo' to perform copy action") assertTrue(metadataFile.isFile) val unzippedMetadataFile = metadataOutputDirectory.resolve("unzipped")
unzipTo(unzippedMetadataFile, metadataFile) val actualUnzippedFiles = unzippedMetadataFile.walkTopDown().filter { it.isFile }.toSet() assertEquals(setOf(unzippedMetadataFile.resolve(KLIB_MANIFEST_PATH)), actualUnzippedFiles)<|endoftext|>
assertEquals(iter3.toList(), emptyList<Int>()) val arr4 = Array(0, { "$it" }) val iter4 = arr4.asIterable() assertEquals(iter4.toList(), emptyList<String>()) } @Test fun asList() {
compare(listOf(1, 2, 3), intArrayOf(1, 2, 3).asList()) { listBehavior() } compare(listOf<Byte>(1, 2, 3), byteArrayOf(1, 2, 3).asList()) { listBehavior() } compare(listOf(true, false), booleanArrayOf(true, false).asList()) { listBehavior() }<|endoftext|>
protected val p3 = p1 fun returnInInternal(): Result<Int> = TODO() protected fun returnInClsProtected(): Result<Int> = TODO() } private class PrivateCls( val r1: Result<Int>, val r2: ResultAlias<Int>?, val r3: List<Result<Int>> ) { companion object {
val cr1: Result<Int> = TODO() private val cr2: Result<Int> = TODO() } val p1 = r1 val p2: Result<String> = TODO() fun returnInPrivate(): Result<Int> = TODO() } fun local(r: Result<Int>) { val l1: Result<Int>? = null<|endoftext|>