prompt
stringlengths
1
924
completion
stringlengths
14
937
try {} catch (<!WRONG_MODIFIER_TARGET!>in<!> <!INCOMPATIBLE_MODIFIERS!>out<!> <!WRONG_MODIFIER_TARGET!>reified<!> <!WRONG_MODIFIER_TARGET!>enum<!> <!WRONG_MODIFIER_TARGET!>public<!> e: Exception) {}
//Check multiple illegal modifiers in catch block<|endoftext|>
class A(val p: String) { val prop: String = throw RuntimeException() } class B(val p: String) { val prop: String = if (p == "test") "OK" else throw RuntimeException() } fun box(): String { var result = "fail" try { if (A("test").prop != "OK") return "fail 1" }
catch (e: RuntimeException) { result = "OK" } if (result != "OK") return "fail 1: $result" if (B("test").prop != "OK") return "fail 2" result = "fail" try { if (B("fail").prop != "OK") return "fail 3" }<|endoftext|>
task.description = "Assemble ${kind.description} '$artifactName' for a target '${target.name}'." task.destinationDir.set(project.layout.buildDirectory.dir("$outDir/${target.visibleName}/${buildType.visibleName}")) task.enabled = target.enabledOnCurrentHostForBinariesCompilation() task.baseName.set(artifactName)
task.optimized.set(buildType.optimized) task.debuggable.set(buildType.debuggable) task.linkerOptions.set(linkerOptions) task.binaryOptions.set(binaryOptions) task.libraries.setFrom(project.configurations.getByName(librariesConfigurationName))<|endoftext|>
fun <Y> pullYb(y: Y): BiType<LevelB, Y> = TODO() fun <X> pullXn(x: X): BiType<X, Nothing> = TODO() fun <Y> pullYn(y: Y): BiType<Nothing, Y> = TODO() } fun <X> adjustIt(fn: () -> X): X = TODO()
fun <X> adjustIt(f1: () -> X, f2: () -> X): X = TODO() fun <X> callAdjustIt(t: BiType<*, *>, x: X, level: LevelA) { val x1 = adjustIt({ t.pullXb(x) }) x1 val x2 = adjustIt({ t.pullXn(x) })<|endoftext|>
* Returns true for effectively public symbols, including internal declarations with @PublishedApi annotation. * In 'Explicit API' mode explicit visibility modifier and explicit return types are required for such symbols. * See FirExplicitApiDeclarationChecker.kt */ public fun isPublicApi(symbol: KtSymbolWithVisibility): Boolean = withValidityAssertion {
analysisSession.visibilityChecker.isPublicApi(symbol) } }<|endoftext|>
// library.kt:45 baz: param:int=6:int, b:int=2:int, inlineCallParam1\11:int=1:int, inlineCallParam2\11:int=2:int, $i$f$inlineCall\11\13:int=0:int, e\11:int=5:int, baz1Param\12:int=1:int,
$i$f$baz1\12\80:int=0:int, baz1Var\12:int=3:int, baz1BlockParam\14:int=1:int, $i$a$-baz1-LibraryKt$inlineCall$1\14\83\11:int=0:int, baz1LambdaVar\14:int=1:int,<|endoftext|>
c.startCoroutine(EmptyContinuation) } class Data(val x: Int) fun box(): String { var result = "" builder { var data = Data(0) var done = false do { data = Data(1) suspendHere() done = true } while (!done)
result = if (data.x == 1) "OK" else "fail" } return result }<|endoftext|>
println("[Cold] Clean build of ${allFiles.size} takes ${MeasureUnits.MILLISECONDS.convert(cleanBuildTime)}") var index = -1 val wmpDone = { index = 0 } val elist = emptyList<File>() var changedFiles = ChangedFiles.Known(dirtyFiles, elist) val update = {
changedFiles = if (index < 0) changedFiles else ChangedFiles.Known(listOf(allFiles[index++]), elist) System.gc() } class CompileTimeResult(val file: String, val time: Long) var maxResult = CompileTimeResult("", -1) var minResult = CompileTimeResult("", Long.MAX_VALUE)<|endoftext|>
firDiagnostic as KtPsiDiagnostic, token, ) } add(FirJsErrors.OVERRIDING_EXTERNAL_FUN_WITH_OPTIONAL_PARAMS) { firDiagnostic -> OverridingExternalFunWithOptionalParamsImpl( firDiagnostic as KtPsiDiagnostic, token, )
} add(FirJsErrors.OVERRIDING_EXTERNAL_FUN_WITH_OPTIONAL_PARAMS_WITH_FAKE) { firDiagnostic -> OverridingExternalFunWithOptionalParamsWithFakeImpl( firSymbolBuilder.functionLikeBuilder.buildFunctionSymbol(firDiagnostic.a),<|endoftext|>
typesWithoutStubs.isNotEmpty() -> { commonSuperType = computeCommonSuperType(typesWithoutStubs) } // `typesWithoutStubs.isEmpty()` means that there are no lower constraints without type variables. // It's only possible for the PCLA case, because otherwise none of the constraints would be considered as proper.
// So, we just get currently computed `commonSuperType` and substitute all local stub types // with corresponding type variables. outerSystemVariablesPrefixSize > 0 -> { // outerSystemVariablesPrefixSize > 0 only for PCLA (K2) @OptIn(K2Only::class)<|endoftext|>
val CANNOT_OVERRIDE_INVISIBLE_MEMBER: KtDiagnosticFactory2<FirCallableSymbol<*>, FirCallableSymbol<*>> by error2<KtNamedDeclaration, FirCallableSymbol<*>, FirCallableSymbol<*>>(SourceElementPositioningStrategies.OVERRIDE_MODIFIER)
val DATA_CLASS_OVERRIDE_CONFLICT: KtDiagnosticFactory2<FirCallableSymbol<*>, FirCallableSymbol<*>> by error2<KtClassOrObject, FirCallableSymbol<*>, FirCallableSymbol<*>>(SourceElementPositioningStrategies.DATA_MODIFIER)<|endoftext|>
package org.jetbrains.kotlin.commonizer.tree.deserializer import kotlin.metadata.KmConstructor import org.jetbrains.kotlin.commonizer.cir.CirClassConstructor import org.jetbrains.kotlin.commonizer.cir.CirContainingClass
import org.jetbrains.kotlin.commonizer.metadata.CirDeserializers import org.jetbrains.kotlin.commonizer.metadata.CirTypeResolver internal object CirTreeClassConstructorDeserializer { operator fun invoke( constructor: KmConstructor, containingClass: CirContainingClass, typeResolver: CirTypeResolver ): CirClassConstructor {<|endoftext|>
inline fun <reified T> inlineFun(t: T) = t // Imports, aliases type references, constructor calls and callable references don't trigger supertype resolution. // There should be no error for backward compatibility, despite the missing supertype. fun test() { @Suppress("UNUSED_VARIABLE") val x: Sub = Sub() Test<Sub>()
useCallRef(::Sub) simpleFun(Sub()) inlineFun<Sub>(Sub()) SubKt.companionMethod() SubKt.InnerObject.objectMethod() }<|endoftext|>
override val size: Int get() = [email protected] override fun isEmpty(): Boolean = [email protected]() override fun contains(element: UInt): Boolean = [email protected](element) override fun get(index: Int): UInt = this@asList[index]
override fun indexOf(element: UInt): Int = [email protected](element) override fun lastIndexOf(element: UInt): Int = [email protected](element) } } /** * Returns a [List] that wraps the original array. */ @SinceKotlin("1.3") @ExperimentalUnsignedTypes<|endoftext|>
fun PublicTopLevelClass_PublicToInternalInnerClass_valueParameter(value: PublicTopLevelClass.PublicToInternalInnerClass?): String = "PublicTopLevelClass.PublicToInternalInnerClass" fun PublicTopLevelClass_PublicToInternalInnerClass_returnType(): PublicTopLevelClass.PublicToInternalInnerClass = fail("PublicTopLevelClass.PublicToInternalInnerClass")
fun PublicTopLevelClass_PublicToInternalInnerClass_anyReturnType(): Any = PublicTopLevelClass().PublicToInternalInnerClass() fun PublicTopLevelClass_PublicToProtectedInnerClass_valueParameter(value: PublicTopLevelClass.PublicToProtectedInnerClass?): String = "PublicTopLevelClass.PublicToProtectedInnerClass"<|endoftext|>
@Test(expected = IllegalCommonizerStateException::class) fun differentReturnTypes1() = doTestFailure( mockValueParam("kotlin/String"), mockValueParam("kotlin/String"), mockValueParam("kotlin/Int") ) @Test(expected = IllegalCommonizerStateException::class) fun differentReturnTypes2() = doTestFailure(
mockValueParam("kotlin/String"), mockValueParam("kotlin/String"), mockValueParam("org/sample/Foo") ) @Test(expected = IllegalCommonizerStateException::class) fun differentReturnTypes3() = doTestFailure( mockValueParam("org/sample/Foo"), mockValueParam("org/sample/Foo"),<|endoftext|>
// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER interface CollectorMock<A, R> interface StreamMock { fun <R, A> collect(collector: CollectorMock<A, R>): R } fun <T> accept(s: T) {} fun ofK(t: String): StreamMock = TODO()
fun <T> toSetK(): CollectorMock<*, T> = TODO() class KotlinCollectionUser1 { fun use() { accept(ofK("").collect(toSetK<String>())) } }<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Int"), DEBUG_INFO_SMARTCAST!>x<!>.propNullableT <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Int & kotlin.Number")!>x<!>.propNullableAny
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Int"), DEBUG_INFO_SMARTCAST!>x<!>.funT() <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Number"), DEBUG_INFO_SMARTCAST!>x<!>.funAny()<|endoftext|>
// This file was generated automatically. See compiler/fir/tree/tree-generator/Readme.md. // DO NOT MODIFY IT MANUALLY. package org.jetbrains.kotlin.fir.declarations import org.jetbrains.kotlin.KtSourceElement import org.jetbrains.kotlin.fir.FirElement
import org.jetbrains.kotlin.fir.FirModuleData import org.jetbrains.kotlin.fir.FirTargetElement import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.expressions.FirBlock<|endoftext|>
"k=interface test.A, arr=[], intArr=[1, 2], arrOfE=[E0], arrOfA=[@test.Empty()])"
val targetJS = "@test.Anno(s=OK, i=42, f=2.718281828, u=43, e=E0, [email protected](b=1, s=1, i=1, f=1, d=1, l=1, c=c, bool=true), k=class A, arr=[...], intArr=[...], arrOfE=[...],<|endoftext|>
package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers import org.jetbrains.kotlin.analysis.low.level.api.fir.api.collectDesignation import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.asResolveTarget import org.jetbrains.kotlin.analysis.low.level.api.fir.api.throwUnexpectedFirElementError<|endoftext|>
// KT-66100: AssertionError: Expected an exception of class IndexOutOfBoundsException to be thrown, but was completed successfully. // IGNORE_BACKEND: JS_IR, JS_IR_ES6 // WITH_STDLIB import kotlin.test.* fun box(): String { val array = UIntArray(10) { 0U }
val array1 = UIntArray(3) { 0U } var j = 8 assertFailsWith<IndexOutOfBoundsException> { for (i in array.size - 1 downTo 0 step 2) { array[j] = 6U j++ } } assertFailsWith<IndexOutOfBoundsException> {<|endoftext|>
name = property.name }.apply { parent = property.parent copyAnnotationsFrom(property) getter = property.getter?.let { buildFunctionWithDisambiguatedSignature(it) } setter = property.setter?.let { buildFunctionWithDisambiguatedSignature(it) } } } class IrLinkerFakeOverrideProvider(
linker: FileLocalAwareLinker, symbolTable: SymbolTable, mangler: KotlinMangler.IrMangler, typeSystem: IrTypeSystemContext, friendModules: Map<String, Collection<String>>, private val partialLinkageSupport: PartialLinkageSupportForLinker, val platformSpecificClassFilter: FakeOverrideClassFilter = DefaultFakeOverrideClassFilter,<|endoftext|>
val fileSerializer = createSerializerForFile(file) return fileSerializer.serializeIrFile(file) } fun serializedIrModule(module: IrModuleFragment): SerializedIrModule { val serializedFiles = module.files .filter { it.packageFragmentDescriptor !is FunctionInterfacePackageFragment } .filter(this::backendSpecificFileFilter)
.map(this::serializeIrFile) if (shouldCheckSignaturesOnUniqueness) { globalDeclarationTable.clashDetector.reportErrorsTo(diagnosticReporter) } return SerializedIrModule(serializedFiles) } }<|endoftext|>
override val isLocal: Boolean get() = true fun index(): Int = hashSig?.toInt() ?: error("Expected index in $this") override fun topLevelSignature(): IdSignature { error("Illegal access: Local Sig does not have toplevel ($this") } override fun nearestPublicSig(): IdSignature {
error("Illegal access: Local Sig does not have information about its public part ($this") } override fun packageFqName(): FqName { error("Illegal access: Local signature does not have package ($this") } override fun equals(other: Any?): Boolean {<|endoftext|>
return listOf(declaration) } } } is IrField -> { declaration.correspondingPropertySymbol?.owner?.let { property -> if (!property.isEffectivelyExternal()) { return listOf(declaration) } } } is IrProperty -> { if (!declaration.isEffectivelyExternal()) {
return listOf() } } } return null } } class LocalDelegatedPropertiesLowering : IrElementTransformerVoid(), BodyLoweringPass { override fun lower(irBody: IrBody, container: IrDeclaration) { irBody.accept(this, null) }<|endoftext|>
* Yields a collections of values to the [Iterator] being built * and suspends until all these values are iterated and the next one is requested. * * @sample samples.collections.Sequences.Building.buildSequenceYieldAll */ public suspend fun yieldAll(elements: Iterable<T>) { if (elements is Collection && elements.isEmpty()) return
return yieldAll(elements.iterator()) } /** * Yields potentially infinite sequence of values to the [Iterator] being built * and suspends until all these values are iterated and the next one is requested. * * The sequence can be potentially infinite. * * @sample samples.collections.Sequences.Building.buildSequenceYieldAll */<|endoftext|>
this.timeout = testRun.checks.executionTimeoutCheck.timeout } val response = executor.execute(request) RunResult( testExecutable = executable, exitCode = response.exitCode, timeout = request.timeout, duration = response.executionTime, hasFinishedOnTime = response.exitCode != null, processOutput = ProcessOutput(
stdOut = outputFilter.filter(stdout.toString("UTF-8")), stdErr = stderr.toString("UTF-8") ) ) } override fun buildResultHandler(runResult: RunResult): ResultHandler = ResultHandler( runResult = runResult, checks = testRun.checks, testRun = testRun,<|endoftext|>
val constraintPosition = VALUE_PARAMETER_POSITION.position(valueParameterDescriptor.index) if (addConstraintForNestedCall(argumentExpression, constraintPosition, builder, newContext, effectiveExpectedType)) return val type = updateResultTypeForSmartCasts(typeInfoForCall.type, argumentExpression, context.replaceDataFlowInfo(dataFlowInfoForArgument))
if (argumentExpression is KtCallableReferenceExpression && type == null) return builder.addSubtypeConstraint( type, builder.compositeSubstitutor().substitute(effectiveExpectedType, Variance.INVARIANT), constraintPosition ) } private fun addConstraintForNestedCall(<|endoftext|>
val outer = ::Outer.call(z1, z2) assertEquals(z1, outer.z1) assertEquals(z2, outer.z2)
assertEquals("Z(x1=1, x2=-1) Z(x1=2, x2=-2) Z(x1=3, x2=-3) Z(x1=4, x2=-4)", Outer::Inner.call(outer, z3, z4).test)<|endoftext|>
objectFactory.property(kotlin.Boolean::class.java).convention(false) override val verbose: org.gradle.api.provider.Property<kotlin.Boolean> = objectFactory.property(kotlin.Boolean::class.java).convention(false)
override val freeCompilerArgs: org.gradle.api.provider.ListProperty<kotlin.String> = objectFactory.listProperty(kotlin.String::class.java).convention(emptyList<String>()) }<|endoftext|>
private const val INLINE_MARKER_BEFORE_METHOD_NAME = "beforeInlineCall" private const val INLINE_MARKER_AFTER_METHOD_NAME = "afterInlineCall" private const val INLINE_MARKER_FINALLY_START = "finallyStart" private const val INLINE_MARKER_FINALLY_END = "finallyEnd"
private const val INLINE_MARKER_BEFORE_SUSPEND_ID = 0 private const val INLINE_MARKER_AFTER_SUSPEND_ID = 1 private const val INLINE_MARKER_RETURNS_UNIT = 2 private const val INLINE_MARKER_FAKE_CONTINUATION = 3<|endoftext|>
is FirConstructor -> { checkDelegatedConstructorIsResolved(target) checkBodyIsResolved(target) } is FirFunction -> checkBodyIsResolved(target) } } } /** * This resolver is responsible for [BODY_RESOLVE][FirResolvePhase.BODY_RESOLVE] phase. * * This resolver:
* - Transforms bodies of declarations. * - Builds [control flow graph][org.jetbrains.kotlin.fir.resolve.dfa.cfg.ControlFlowGraph]. * * Before the transformation, the resolver [recreates][BodyStateKeepers] all bodies * to prevent corrupted states due to [PCE][com.intellij.openapi.progress.ProcessCanceledException]. *<|endoftext|>
// EXPECTED_REACHABLE_NODES: 1282 // MODULE: lib // FILE: lib.kt package foo inline fun bar(x: Int = 0) = x + 10 // MODULE: main(lib) // FILE: main.kt package foo // CHECK_NOT_CALLED: bar fun box(): String { assertEquals(10, bar())
assertEquals(11, bar(1)) return "OK" }<|endoftext|>
expect fun useBox(x: Box<X>) """.trimIndent() ) } fun `test boxed parameter in function - TA expansion not commonized`() { val result = commonize { outputTarget("(a, b)") simpleSingleSourceTarget( "a", """ class Box<T> class A typealias X = A
fun useBox(x: Box<X>) {} """.trimIndent() ) simpleSingleSourceTarget( "b", """ class Box<T> class B typealias X = B fun useBox(x: Box<X>) {} """.trimIndent() ) } result.assertCommonized(<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Number"), DEBUG_INFO_SMARTCAST!>x<!>.propAny <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Int"), DEBUG_INFO_SMARTCAST!>x<!>.propNullableT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Int & kotlin.Number")!>x<!>.propNullableAny <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Int"), DEBUG_INFO_SMARTCAST!>x<!>.funT()<|endoftext|>
if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}"
return "OK" }<|endoftext|>
}, { <!CANNOT_INFER_PARAMETER_TYPE!>it<!> -> <!DEBUG_INFO_EXPRESSION_TYPE("ERROR CLASS: Cannot infer type for parameter it")!>it<!> })<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function<kotlin.Any>")!>select(A3(), <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.reflect.KFunction2<A3, kotlin.Int, kotlin.Unit>")!>A3::foo1<!>, {<|endoftext|>
complexInlineFun(2.0, DPoint(3.0, 5.0), 7.0, DPoint(11.0, 13.0)) } require(RegularObject.pointToString() == "DPoint(x=0.0, y=0.0)") { RegularObject.pointToString() }
require(getLineIntersectionPoint().toString() == "DPoint(x=0.0, y=0.0)") { getLineIntersectionPoint().toString() } require(DPoint(1.0) == DPoint(1.0, 1.0)) { DPoint(1.0).toString() }<|endoftext|>
try { if (a !is B) { throw AssertionError() } } catch (e: Throwable) {} takeB(<!TYPE_MISMATCH!>a<!>) } fun conditionalThrowInTry_rethrow_smartcastAfterTryCatch(a: A) { try { if (a !is B) {
throw AssertionError() } } catch (e: Throwable) { throw e } takeB(<!DEBUG_INFO_SMARTCAST!>a<!>) } fun conditionalThrowInTry_rethrow_smartcastAfterTryCatchFinally(a: A) { try { if (a !is B) { throw AssertionError()<|endoftext|>
abstract class A1<Q> : MutableCollection<Q> { override fun contains(o: Q): Boolean { throw UnsupportedOperationException() } override fun containsAll(c: Collection<Q>): Boolean { throw UnsupportedOperationException() } } abstract class A2 : MutableCollection<String> { override fun contains(o: String): Boolean {
throw UnsupportedOperationException() } override fun containsAll(c: Collection<String>): Boolean { throw UnsupportedOperationException() } } abstract class A3<W> : java.util.AbstractList<W>() abstract class A4<W> : java.util.AbstractList<W>() { override fun contains(o: W): Boolean {<|endoftext|>
import org.jetbrains.kotlin.native.interop.gen.jvm.KotlinPlatform import org.jetbrains.kotlin.native.interop.gen.jvm.buildNativeLibrary import org.jetbrains.kotlin.native.interop.gen.jvm.prepareTool import org.jetbrains.kotlin.native.interop.indexer.HeaderId
import org.jetbrains.kotlin.native.interop.indexer.IndexerResult import org.jetbrains.kotlin.native.interop.indexer.Location import org.jetbrains.kotlin.native.interop.indexer.NativeLibrary import org.jetbrains.kotlin.native.interop.tool.CInteropArguments import kotlin.test.*<|endoftext|>
// WITH_STDLIB // WITH_COROUTINES // IGNORE_BACKEND: JVM // LANGUAGE: +SuspendFunctionsInFunInterfaces, +JvmIrEnabledByDefault // SKIP_DCE_DRIVEN import helpers.* import kotlin.coroutines.* fun interface Action { suspend fun run() }
suspend fun runAction(a: Action) { a.run() } fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } fun box(): String { var res = "FAIL" builder { runAction { res = "OK" } } return res }<|endoftext|>
* Describes various type conversions for [TypeMirror]. */ sealed class TypeInfo { /** * The conversion from [TypeMirror.argType] to [bridgedType]. */ abstract fun argToBridged(expr: KotlinExpression): KotlinExpression /** * The conversion from [bridgedType] to [TypeMirror.argType]. */
abstract fun argFromBridged( expr: KotlinExpression, scope: KotlinScope, nativeBacked: NativeBacked ): KotlinExpression abstract val bridgedType: BridgedType open fun cFromBridged( expr: NativeExpression, scope: NativeScope, nativeBacked: NativeBacked ): NativeExpression = expr<|endoftext|>
create: (compilation: KotlinJsIrCompilation, name: String, mode: KotlinJsBinaryMode) -> T, ) = modes.map { createBinary( compilation, it, jsBinaryType, create ) } private fun <T : JsIrBinary> createBinary(
compilation: KotlinJsIrCompilation, mode: KotlinJsBinaryMode, jsBinaryType: KotlinJsBinaryType, create: (compilation: KotlinJsIrCompilation, name: String, mode: KotlinJsBinaryMode) -> T, ): JsIrBinary { val name = generateBinaryName( compilation, mode,<|endoftext|>
@Throws(CancellationExceptionAlias::class) suspend fun suspendThrowsCancellationExceptionTypealias() {} @Throws(IllegalStateException::class) suspend fun suspendThrowsIllegalStateException1() {} @Throws(Exception2::class, IllegalStateException::class) suspend fun suspendThrowsIllegalStateException2() {} typealias IllegalStateExceptionAlias = IllegalStateException
@Throws(IllegalStateExceptionAlias::class) suspend fun suspendThrowsIllegalStateExceptionTypealias() {} @Throws(RuntimeException::class) suspend fun suspendThrowsRuntimeException1() {} @Throws(RuntimeException::class, Exception3::class) suspend fun suspendThrowsRuntimeException2() {} typealias RuntimeExceptionAlias = RuntimeException<|endoftext|>
result += incompatibilityRegister(SEALED_KEYWORD, INNER_KEYWORD) // header / expect / impl / actual are all incompatible result += incompatibilityRegister(HEADER_KEYWORD, EXPECT_KEYWORD, IMPL_KEYWORD, ACTUAL_KEYWORD) return result }
private fun incompatibilityRegister(vararg list: KtKeywordToken): Map<Pair<KtKeywordToken, KtKeywordToken>, Compatibility> { return compatibilityRegister(Compatibility.INCOMPATIBLE, *list) } private fun redundantRegister( sufficient: KtKeywordToken, redundant: KtKeywordToken<|endoftext|>
for (overriddenMember in member.overriddenDescriptors) { val memberToCopy = if (overriddenMember.kind.isReal) overriddenMember else findMemberToCopy(overriddenMember) ?: continue val classToCopyFrom = memberToCopy.containingDeclaration as ClassDescriptor if (classToCopyFrom.kind != ClassKind.INTERFACE) continue
copyMember(memberToCopy, classToCopyFrom, descriptor, model) } } private fun copyMember(member: CallableMemberDescriptor, from: ClassDescriptor, to: ClassDescriptor, model: JsClassModel) { val name = context.getNameForDescriptor(member).ident when (member) { is FunctionDescriptor -> {<|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>() val uintProgression = 1u..<5u for (i in uintProgression step 1) { uintList += i } assertEquals(listOf(1u, 2u, 3u, 4u), uintList) val ulongList = mutableListOf<ULong>()<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & ClassLevel5")!>x<!>.propNullableAny <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & ClassLevel5")!>x<!>.funT()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & ClassLevel5")!>x<!>.funAny() <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & ClassLevel5")!>x<!>.funNullableT()<|endoftext|>
import org.jetbrains.kotlin.konan.util.visibleName import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly import java.io.ByteArrayOutputStream import java.io.File import java.nio.file.Files import javax.inject.Inject
class FrameworkDsymLayout(val rootDir: File) { init { require(rootDir.name.endsWith(".framework.dSYM")) } private val frameworkName = rootDir.name.removeSuffix(".framework.dSYM") val binaryDir = rootDir.resolve("Contents/Resources/DWARF") val binary = binaryDir.resolve(frameworkName)<|endoftext|>
val newDeclaration = super.lowerInterfaceDeclaration(declaration, owner) return newDeclaration.copy( parents = declaration.parents.mapNotNull { resolveInheritance(it) } ) } override fun lowerDictionaryDeclaration(declaration: IDLDictionaryDeclaration, owner: IDLFileDeclaration): IDLDictionaryDeclaration {
val newDeclaration = super.lowerDictionaryDeclaration(declaration, owner) return newDeclaration.copy( parents = declaration.parents.mapNotNull { resolveInheritance(it) } ) } override fun lowerFileDeclaration(fileDeclaration: IDLFileDeclaration): IDLFileDeclaration { currentFile = fileDeclaration<|endoftext|>
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.callableIdForConstructor import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.utils.addToStdlib.shouldNotBeCalled public class ConstructorBuildingContext( session: FirSession, key: GeneratedDeclarationKey, owner: FirClassSymbol<*>, private val isPrimary: Boolean<|endoftext|>
firInitializerExpression: FirExpression?, type: IrType? = null ): IrField = convertCatching(firProperty) { val inferredType = type ?: firInitializerExpression!!.resolvedType.toIrType(c)
return (firProperty.delegate ?: firProperty.backingField ?: firProperty).convertWithOffsets { startOffset: Int, endOffset: Int -> irFactory.createField( startOffset = startOffset, endOffset = endOffset, origin = origin, name = name, visibility = visibility, symbol = symbol, type = inferredType,<|endoftext|>
get() = parameters.filter { it.kind == KParameter.Kind.VALUE } /** * Returns the parameter of this callable with the given name, or `null` if there's no such parameter. */ @SinceKotlin("1.1") fun KCallable<*>.findParameterByName(name: String): KParameter? { return parameters.singleOrNull { it.name == name } }
/** * Calls a callable in the current suspend context. If the callable is not a suspend function, behaves as [KCallable.call]. * Otherwise, calls the suspend function with current continuation. */ @SinceKotlin("1.3") suspend fun <R> KCallable<R>.callSuspend(vararg args: Any?): R {<|endoftext|>
object FirExplicitApiDeclarationChecker : FirDeclarationSyntaxChecker<FirDeclaration, KtDeclaration>() { private val codeFragmentTypes = setOf(KtNodeTypes.BLOCK_CODE_FRAGMENT, KtNodeTypes.EXPRESSION_CODE_FRAGMENT, KtNodeTypes.TYPE_CODE_FRAGMENT)
override fun checkPsiOrLightTree( element: FirDeclaration, source: KtSourceElement, context: CheckerContext, reporter: DiagnosticReporter ) { if ((source.kind !is KtRealSourceElementKind && source.kind != KtFakeSourceElementKind.PropertyFromParameter) || element !is FirMemberDeclaration ) { return<|endoftext|>
import org.jetbrains.kotlin.resolve.calls.results.SimpleConstraintSystem import org.jetbrains.kotlin.types.TypeConstructorSubstitution import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner import org.jetbrains.kotlin.types.model.*
import org.jetbrains.kotlin.types.typeUtil.asTypeProjection class SimpleConstraintSystemImpl( constraintInjector: ConstraintInjector, builtIns: KotlinBuiltIns, kotlinTypeRefiner: KotlinTypeRefiner, languageVersionSettings: LanguageVersionSettings ) : SimpleConstraintSystem {<|endoftext|>
// TARGET_BACKEND: JVM // FILE: Box.java class Box<B> { public B f; public Box(B b) { this.f = b; } } // FILE: JOuter.java public class JOuter<O1, O2> { public O1 o1; public O2 o2;
public JOuter(O1 a1, O2 a2) { this.o1 = a1; this.o2 = a2; } public JInner<Box<O1>, ?> instance(O1 s1, O2 s2) { return new JInner<Box<O1>, O2>(new Box(s1), s2); }<|endoftext|>
package org.jetbrains.kotlin.js.resolve.diagnostics import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget import org.jetbrains.kotlin.name.JsStandardClassIds import org.jetbrains.kotlin.js.validateQualifier
import org.jetbrains.kotlin.psi.KtAnnotated import org.jetbrains.kotlin.psi.KtAnnotationEntry import org.jetbrains.kotlin.resolve.AdditionalAnnotationChecker import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.BindingTrace<|endoftext|>
this<!UNRESOLVED_REFERENCE!>@String<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!> this<!UNRESOLVED_REFERENCE!>@Int<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>toDouble<!>() }
<!UNSUPPORTED_FEATURE!>context(String)<!> val p: String get() = this<!UNRESOLVED_REFERENCE!>@String<!><|endoftext|>
override fun ExpressionCodegen.addElementsContentToDescriptor(descriptorVar: Int) = with(v) { val enumEntries = serializableDescriptor.enumEntries() for (entry in enumEntries) { load(descriptorVar, descImplType) // regular .serialName() produces fqName here, which is kinda inconvenient for enum entry
val serialName = entry.annotations.serialNameValue ?: entry.name.toString() aconst(serialName) iconst(0) invokevirtual(descImplType.internalName, CallingConventions.addElement, "(Ljava/lang/String;Z)V", false) // pushing annotations<|endoftext|>
private fun PhaseEngine<out Context>.splitIntoFragments( input: IrModuleFragment, ): Sequence<BackendJobFragment> { val config = context.config return if (context.config.producePerFileCache) { val files = input.files.toList() val containsStdlib = config.libraryToCache!!.klib == context.stdlibModule.konanLibrary
files.asSequence().filter { !it.isFunctionInterfaceFile }.map { file -> val cacheDeserializationStrategy = CacheDeserializationStrategy.SingleFile(file.path, file.packageFqName.asString()) val llvmModuleSpecification = CacheLlvmModuleSpecification( config.cachedLibraries,<|endoftext|>
val analyzerFacade = TopDownAnalyzerFacadeForWasm.facadeFor(configuration.get(WasmConfigurationKeys.WASM_TARGET)) val hasErrors = analyzerFacade.checkForErrors(sourceFiles, analysisResult.bindingContext, errorPolicy) val metadataSerializer = KlibMetadataIncrementalSerializer( sourceFiles, configuration, project,
analysisResult.bindingContext, moduleFragment.descriptor, hasErrors, ) return IrBackendInput.WasmBackendInput( moduleFragment, pluginContext, icData, diagnosticReporter = DiagnosticReporterFactory.createReporter(), hasErrors,<|endoftext|>
* Returns the first element yielding the smallest value of the given function. * * @throws NoSuchElementException if the array is empty. * * @sample samples.collections.Collections.Aggregates.minBy */ @SinceKotlin("1.7") @kotlin.jvm.JvmName("minByOrThrow") @Suppress("CONFLICTING_OVERLOADS")
public inline fun <R : Comparable<R>> LongArray.minBy(selector: (Long) -> R): Long { if (isEmpty()) throw NoSuchElementException() var minElem = this[0] val lastIndex = this.lastIndex if (lastIndex == 0) return minElem var minValue = selector(minElem) for (i in 1..lastIndex) {<|endoftext|>
val inner = outer.subjectVar.initializer?.matchIfNullExpr() ?: return this val innerKeepsNull = inner.ifNullExpr.isNull(inner.subjectVar.symbol, true) val innerDiscardsNonNull = inner.ifNotNullExpr.isNull(inner.subjectVar.symbol, false)
if ((!outer.ifNotNullExpr.isTrivial() && innerKeepsNull != true && innerDiscardsNonNull != true) || (!outer.ifNullExpr.isTrivial() && innerKeepsNull != false && innerDiscardsNonNull != false) ) return this val result = inner.createIrBuilder().irBlock {<|endoftext|>
private fun getSubPackagesFqNames(packageFragmentProvider: PackageFragmentProvider, fqName: FqName, result: MutableSet<FqName>) { if (!fqName.isRoot) { result.add(fqName) } for (subPackage in packageFragmentProvider.getSubPackagesOf(fqName) { true }) {
getSubPackagesFqNames(packageFragmentProvider, subPackage, result) } } @JvmStatic fun readModuleAsProto(metadata: ByteArray, metadataVersion: JsMetadataVersion): KotlinJavaScriptLibraryParts { val (header, content) = GZIPInputStream(ByteArrayInputStream(metadata)).use { stream -><|endoftext|>
val traceHolder = CliTraceHolder(project) val cliLightClassGenerationSupport = CliLightClassGenerationSupport(traceHolder, project) val kotlinAsJavaSupport = CliKotlinAsJavaSupport(project, traceHolder) registerService(LightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
registerService(CliLightClassGenerationSupport::class.java, cliLightClassGenerationSupport) registerService(KotlinAsJavaSupport::class.java, kotlinAsJavaSupport) registerService(CodeAnalyzerInitializer::class.java, traceHolder) // We don't pass Disposable because in some tests, we manually unregister these extensions, and that leads to LOG.error<|endoftext|>
is PackageViewDescriptor -> qualifier.memberScope.getContributedClassifier(lastPart.name, lastPart.location) is ClassDescriptor -> { val descriptor = qualifier.unsubstitutedInnerClassesScope.getContributedClassifier(lastPart.name, lastPart.location) checkNotEnumEntry(descriptor, trace, lastPart.expression) descriptor }
else -> null } storeResult(trace, lastPart.expression, classifier, ownerDescriptor, position = QualifierPosition.TYPE, isQualifier = isQualifier) return TypeQualifierResolutionResult(qualifierPartList, classifier) }<|endoftext|>
internal fun encodeToByteArrayImpl(source: ByteArray, startIndex: Int, endIndex: Int): ByteArray { checkSourceBounds(source.size, startIndex, endIndex) val encodeSize = encodeSize(endIndex - startIndex) val destination = ByteArray(encodeSize) encodeIntoByteArrayImpl(source, destination, 0, startIndex, endIndex) return destination
} internal fun encodeIntoByteArrayImpl( source: ByteArray, destination: ByteArray, destinationOffset: Int, startIndex: Int, endIndex: Int ): Int { checkSourceBounds(source.size, startIndex, endIndex) checkDestinationBounds(destination.size, destinationOffset, encodeSize(endIndex - startIndex))<|endoftext|>
errorKt.writeText("<COMPILE_ERROR_MARKER>") buildAndFail("assemble") { assertTasksFailed(":kaptGenerateStubsKotlin") } errorKt.deleteIfExists() bKt.modify { "$it\n" }
build("assemble", buildOptions = buildOptions.copy(logLevel = LogLevel.DEBUG)) { assertCompiledKotlinSources(listOf(projectPath.relativize(bKt)), output) assertTasksExecuted(":kaptGenerateStubsKotlin", ":compileKotlin") } } }<|endoftext|>
tmpdir = KtTestUtil.tmpDirForTest( testInfo.testClass.getOrNull()?.simpleName ?: "TEST", testInfo.displayName ) } fun runTest(filePath: String) { val testDir = File(filePath) val testFile = File(testDir, "build.txt")
assert(testFile.isFile) { "build.txt doesn't exist" } testDir.listFiles()?.forEach { it.copyRecursively(File(tmpdir, it.name)) } doTestInTempDirectory(testFile, File(tmpdir, testFile.name)) } private class GotResult(val actual: String): RuntimeException()<|endoftext|>
return runningFoldIndexed(initial, operation) } /** * Returns a list containing successive accumulation values generated by applying [operation] from left to right * to each element, its index in the original array and current accumulator value that starts with [initial] value. * * Note that `acc` value passed to [operation] function should not be mutated; * otherwise it would affect the previous value in resulting list. *
* @param [operation] function that takes the index of an element, current accumulator value * and the element itself, and calculates the next accumulator value. * * @sample samples.collections.Collections.Aggregates.scan */ @SinceKotlin("1.4") @ExperimentalUnsignedTypes @kotlin.internal.InlineOnly<|endoftext|>
import org.jetbrains.kotlin.gradle.plugin.ide.kotlinIdeMultiplatformImport import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.util.applyMultiplatformPlugin import org.jetbrains.kotlin.gradle.util.buildProject
import org.jetbrains.kotlin.gradle.util.enableDependencyVerification import kotlin.test.Test class WasmDependencyResolutionSmokeTest { @Test fun `test - project to project ide dependency resolution`() { val rootProject = buildProject() val consumer = buildProject(projectBuilder = { withName("consumer").withParent(rootProject) })<|endoftext|>
val results = MockResultsConsumer() runCommonization(originalModules.toCommonizerParameters(results)) assertEquals(Status.NOTHING_TO_DO, results.status) assertTrue(results.modulesByTargets.isEmpty()) } private fun doTestSuccessfulCommonization(originalModules: Map<String, List<String>>) { val results = MockResultsConsumer()
runCommonization(originalModules.toCommonizerParameters(results)) assertEquals(Status.DONE, results.status) val expectedCommonModuleNames = mutableSetOf<String>() originalModules.values.forEachIndexed { index, moduleNames -> if (index == 0) expectedCommonModuleNames.addAll(moduleNames) else<|endoftext|>
// CURIOUS_ABOUT: writeToParcel, createFromParcel, <clinit> // WITH_STDLIB import kotlinx.parcelize.* import android.os.Parcelable import java.io.Serializable class SerializableSimple(val a: String, val b: String) : Serializable @Parcelize
class User(val notNull: SerializableSimple, val nullable: SerializableSimple) : Parcelable<|endoftext|>
} throw new AssertionError("NullPointerException expected, but nothing was thrown, parameter index = " + i); } } } // FILE: box.kt fun f(
p01: Any, p02: Any, p03: Any, p04: Any, p05: Any, p06: Any, p07: Any, p08: Any, p09: Any, p10: Any,<|endoftext|>
val isArrayReceiver = name.asString().isMangledAtomicArrayExtension() return if (isArrayReceiver) checkSyntheticArrayElementExtensionParameter() else checkSyntheticAtomicExtensionParameters() } abstract fun IrFunction.checkSyntheticAtomicExtensionParameters(): Boolean abstract fun IrFunction.checkSyntheticArrayElementExtensionParameter(): Boolean
abstract fun IrFunction.checkSyntheticParameterTypes(isArrayReceiver: Boolean, receiverValueType: IrType): Boolean abstract fun IrExpression.isArrayElementReceiver( parentFunction: IrFunction? ): Boolean override fun visitBlockBody(body: IrBlockBody, data: IrFunction?): IrBody { // Erase messages added by the Trace object from the function body:<|endoftext|>
0x7ff8000000000000UL, 0x0UL, 0x3ff0000000000000UL, 0x7ff8000000000000UL, 0x7ff8000000000000UL, 0x3ff0000000000000UL, 0x3ff0000000000000UL, 0x3ff0000000000000UL,
0x3ff0000000000000UL, 0x3ff0000000000000UL, 0x7ff8000000000000UL, 0x7ff8000000000000UL, 0x3ff0000000000000UL, 0x3ff0000000000000UL, 0x3ff0000000000000UL, 0x3ff0000000000000UL,<|endoftext|>
val DOCUMENT_POSITION_CONTAINED_BY: Short val DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: Short } } /** * Exposes the JavaScript [SVGImageElement](https://developer.mozilla.org/en/docs/Web/API/SVGImageElement) to Kotlin */
public external abstract class SVGImageElement : SVGGraphicsElement, SVGURIReference, HTMLOrSVGImageElement { open val x: SVGAnimatedLength open val y: SVGAnimatedLength open val width: SVGAnimatedLength open val height: SVGAnimatedLength open val preserveAspectRatio: SVGAnimatedPreserveAspectRatio open var crossOrigin: String?<|endoftext|>
import org.jetbrains.kotlin.tooling.core.UnsafeApi import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNull @OptIn(UnsafeApi::class) class SourceSetCommonizerTargetTest { private lateinit var project: ProjectInternal
private lateinit var kotlin: KotlinMultiplatformExtension @BeforeTest fun setup() { project = buildProject() addBuildEventsListenerRegistryMock(project) project.plugins.apply("kotlin-multiplatform") kotlin = project.extensions.getByName("kotlin") as KotlinMultiplatformExtension } @Test<|endoftext|>
// TARGET_BACKEND: JVM // WITH_STDLIB import kotlin.test.assertEquals class Klass inline fun <reified T : Any> simpleName(): String = T::class.java.getSimpleName() inline fun <reified T : Any> simpleName2(): String {
val kClass = T::class // Intrinsic for T::class.java is not used return kClass.java.getSimpleName() } fun box(): String { assertEquals("Integer", simpleName<Int>()) assertEquals("Integer", simpleName2<Int>()) assertEquals("Klass", simpleName<Klass>()) return "OK" }<|endoftext|>
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET, WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@receiver:Ann<!> constructor(<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@receiver:Ann<!> a: String)
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@receiver:Ann<!> protected val simpleProperty: String = "text" <!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@receiver:Ann<!> fun anotherFun() {<|endoftext|>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>v<!>.inv() } } // TESTCASE NUMBER: 16 fun case_16(map: Map<Int?, Int?>) { for ((k, v) in map) {
if (k !== implicitNullableNothingProperty && v !== implicitNullableNothingProperty) else { continue } <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>k<!> <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>k<!>.inv()<|endoftext|>
project("simpleProject", gradleVersion) { buildAndFail( "compileKotlin", buildOptions = defaultBuildOptions.copy( buildReport = listOf(BuildReportType.JSON) ) ) { assertOutputContains("Can't configure json report: 'kotlin.build.report.json.directory' property is mandatory") } } }
@DisplayName("json report") @GradleTestVersions( additionalVersions = [TestVersions.Gradle.G_7_6, TestVersions.Gradle.G_8_0], ) @GradleTest fun testJsonBuildReport(gradleVersion: GradleVersion) { project("simpleProject", gradleVersion) { build( "compileKotlin",<|endoftext|>
<!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) inline fun <T> testDifferencesInReifiedBehaviorOfTypeParameterBReverse(arg: T)<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) inline fun <reified T> testDifferencesInReifiedBehaviorOfTypeParameterC(arg: Invariant<T>)<!> {}<|endoftext|>
private object A212 { val a = Random.nextInt(100) } private object A213 { val a = Random.nextInt(100) } private object A214 { val a = Random.nextInt(100) } private object A215 { val a = Random.nextInt(100) } private object A216 { val a = Random.nextInt(100) }
private object A217 { val a = Random.nextInt(100) } private object A218 { val a = Random.nextInt(100) } private object A219 { val a = Random.nextInt(100) } private object A220 { val a = Random.nextInt(100) } private object A221 { val a = Random.nextInt(100) }<|endoftext|>
import androidx.compose.compiler.plugins.kotlin.ModuleMetrics import androidx.compose.compiler.plugins.kotlin.analysis.StabilityInferencer import androidx.compose.compiler.plugins.kotlin.lower.decoys.CreateDecoysTransformer import androidx.compose.compiler.plugins.kotlin.lower.decoys.isDecoy
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureFactory import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.descriptors.Modality<|endoftext|>
fun hasTailrec(): Boolean = hasFlag(ModifierFlag.FUNCTION_TAILREC) fun hasOperator(): Boolean = hasFlag(ModifierFlag.FUNCTION_OPERATOR) fun hasInfix(): Boolean = hasFlag(ModifierFlag.FUNCTION_INFIX) fun hasInline(): Boolean = hasFlag(ModifierFlag.FUNCTION_INLINE)
fun hasExternal(): Boolean = hasFlag(ModifierFlag.FUNCTION_EXTERNAL) fun hasSuspend(): Boolean = hasFlag(ModifierFlag.FUNCTION_SUSPEND) fun isConst(): Boolean = hasFlag(ModifierFlag.PROPERTY_CONST) fun hasModality(modality: Modality): Boolean { return when {<|endoftext|>
import org.jetbrains.kotlin.extensions.ProjectExtensionDescriptor import org.jetbrains.kotlin.psi.KtAnnotated import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.constants.ArrayValue
import org.jetbrains.kotlin.resolve.constants.StringValue interface DiagnosticSuppressor { fun isSuppressed(diagnostic: Diagnostic): Boolean fun isSuppressed(diagnostic: Diagnostic, bindingContext: BindingContext?): Boolean = isSuppressed(diagnostic) companion object : ProjectExtensionDescriptor<DiagnosticSuppressor>(<|endoftext|>
* See the License for the specific language governing permissions and * limitations under the License. */ package kotlin.text.regex /** * Match result implementation */ internal class MatchResultImpl /** * @param input an input sequence for matching/searching. * @param regex a [Regex] instance used for matching/searching. */
constructor (internal val input: CharSequence, internal val regex: Regex) : MatchResult { // Harmony's implementation ======================================================================================== private val nativePattern = regex.nativePattern private val groupCount = nativePattern.capturingGroups.size private val groupBounds = IntArray(groupCount * 2) { -1 }<|endoftext|>
phase = IdeMultiplatformImport.DependencyResolutionPhase.BinaryDependencyResolution, priority = IdeMultiplatformImport.Priority.normal ) registerDependencyResolver( resolver = IdeCInteropMetadataDependencyClasspathResolver, constraint = SourceSetConstraint.isNative and !SourceSetConstraint.isSingleKotlinTarget,
phase = IdeMultiplatformImport.DependencyResolutionPhase.BinaryDependencyResolution, priority = IdeMultiplatformImport.Priority.normal ) registerDependencyResolver( resolver = IdeProjectToProjectCInteropDependencyResolver, constraint = SourceSetConstraint.isNative and SourceSetConstraint.isSingleKotlinTarget,<|endoftext|>
} } private fun TestProject.testUpToDateOnChangingConsumerTargets( dependencyMode: String ) { build(":p2:transformCommonMainCInteropDependenciesMetadata", dependencyMode) build(":p2:transformCommonMainCInteropDependenciesMetadata", dependencyMode) {
assertTasksUpToDate(":p2:transformCommonMainCInteropDependenciesMetadata") } val optionToEnableAdditionalTarget = "-Pp2.enableAdditionalTarget" build( ":p2:transformCommonMainCInteropDependenciesMetadata", optionToEnableAdditionalTarget, dependencyMode ) {<|endoftext|>
internal fun isInsideExternalClass(containingClass: FirClass, context: CheckerContext): Boolean { return isInsideSpecificClass(containingClass, context) { klass -> klass is FirRegularClass && klass.isExternal } } // Note that the class that contains the currently visiting declaration will *not* be in the context's containing declarations *yet*. private inline fun isInsideSpecificClass( containingClass: FirClass,
context: CheckerContext, predicate: (FirClass) -> Boolean ): Boolean { return predicate.invoke(containingClass) || context.containingDeclarations.asReversed().any { it is FirRegularClass && predicate.invoke(it) } } internal fun FirMemberDeclaration.isEffectivelyFinal(context: CheckerContext): Boolean =<|endoftext|>
expectFailure(linkage("Class initialization error: Constructor 'InterfaceToOpenClassImpl.<init>' should call a constructor of direct super class 'InterfaceToOpenClass' but calls 'Any.<init>' instead")) { getInterfaceToOpenClassImplAsAny() }
expectFailure(linkage("Class initialization error: Constructor 'InterfaceToOpenClassImpl.<init>' should call a constructor of direct super class 'InterfaceToOpenClass' but calls 'Any.<init>' instead")) { getInterfaceToOpenClassImplAsAnyInline() }<|endoftext|>
return listOf(File("analysis/analysis-api/testData/helpers/hasCommonSubtype/helpers.kt").toTestFile()) } } private val PsiElement.positionString: String get() { val illegalCallPos = StringUtil.offsetToLineColumn(containingFile.text, textRange.startOffset)
return "${containingFile.virtualFile.path}:${illegalCallPos.line + 1}:${illegalCallPos.column + 1}" } }<|endoftext|>
assertEquals("Saint-Petersburg", o.nativeFooNWrapper.nativeFooN?.s) o.nativeFooNWrapper = NativeFooNWrapper(null) assertEquals("null (object)", describeValueOfProperty(o, "nativeFooNWrapper")) assertEquals(null, o.nativeFooNWrapper.nativeFooN?.s)
assertEquals("null (object)", describeValueOfProperty(o, "nativeFooNWrapperN")) o.nativeFooNWrapperN = NativeFooNWrapper(NativeFoo("Boston")) assertEquals("NativeFooNWrapper(nativeFooN=NativeFoo('Boston')) (object)", describeValueOfProperty(o, "nativeFooNWrapperN"))<|endoftext|>
"Exporting name ''{0}'' clashes with {1}", CommonRenderers.STRING, JS_KLIB_EXPORTS ) map.put( JsKlibErrors.EXPORTING_JS_NAME_CLASH_ES, "Exporting name ''{0}'' in ES modules may clash with {1}", CommonRenderers.STRING,
JS_KLIB_EXPORTS, ) map.put( JsKlibErrors.JSCODE_CAN_NOT_VERIFY_JAVASCRIPT, "Cannot verify JavaScript code because the argument is not a constant string" ) map.put( JsKlibErrors.JSCODE_NO_JAVASCRIPT_PRODUCED,<|endoftext|>
} assertFailsWith<IndexOutOfBoundsException> { refArr[100] = Data(100) }.let { ex -> assertEquals("The index 100 is out of the bounds of the AtomicArray with size 10.", ex.message) } assertFailsWith<IndexOutOfBoundsException> { refArr[-1] = Data(-1)
}.let { ex -> assertEquals("The index -1 is out of the bounds of the AtomicArray with size 10.", ex.message) } } @Test fun compareAndExchange() { val refArr = AtomicArray<Data?>(10) { null } val newValue = Data(1)<|endoftext|>
putValueArgument(1, right) } } val leftNullCheck = left.type.isNullable() val rightNullCheck = rightIsUnboxed && right.type.isNullable() // equals-impl has a nullable second argument return if (leftNullCheck || rightNullCheck) { irBlock {
val leftVal = if (left is IrGetValue) left.symbol.owner else irTemporary(left) val rightVal = if (right is IrGetValue) right.symbol.owner else irTemporary(right) val equalsCall = equals( if (leftNullCheck) irImplicitCast(irGet(leftVal), left.type.makeNotNull()) else irGet(leftVal),<|endoftext|>
this, DECLARATION_ORIGIN_COROUTINE_IMPL, index = valueParameters.size, type = continuationType ) val irBuilder = context.createIrBuilder(symbol, startOffset, endOffset) body = irBuilder.irBlockBody { val completionParameter = valueParameters.last() +irDelegatingConstructorCall(coroutineBaseClassConstructor).apply {
putValueArgument(0, irGet(completionParameter)) } +IrInstanceInitializerCallImpl(startOffset, endOffset, coroutineClass.symbol, context.irBuiltIns.unitType) functionParameters.forEachIndexed { index, parameter -> +irSetField( irGet(coroutineClassThis), argumentToPropertiesMap.getValue(parameter),<|endoftext|>