prompt
stringlengths
1
924
completion
stringlengths
14
937
@SinceKotlin("1.3") @ExperimentalTime @Deprecated("Use 'Double.seconds' extension property from Duration.Companion instead.", ReplaceWith("this.seconds", "kotlin.time.Duration.Companion.seconds")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "1.8", hiddenSince = "1.9")
public val Double.seconds: Duration get() = toDuration(DurationUnit.SECONDS) /** Returns a [Duration] equal to this [Int] number of minutes. */ @SinceKotlin("1.3") @ExperimentalTime<|endoftext|>
public fun kotlin.Short.toHexString(format: kotlin.text.HexFormat = ...): kotlin.String @kotlin.ExperimentalStdlibApi @kotlin.SinceKotlin(version = "1.9") @kotlin.internal.InlineOnly
public inline fun kotlin.UByte.toHexString(format: kotlin.text.HexFormat = ...): kotlin.String @kotlin.ExperimentalStdlibApi @kotlin.SinceKotlin(version = "1.9") @kotlin.ExperimentalUnsignedTypes @kotlin.internal.InlineOnly<|endoftext|>
irBuiltIns.createIrBuilder(getter.symbol, SYNTHETIC_OFFSET, SYNTHETIC_OFFSET).irBlockBody { +irReturn( IrGetEnumValueImpl(startOffset, endOffset, enumClass.defaultType, entrySymbol) ) }
private fun declareEntryAliasProperty(propertyDescriptor: PropertyDescriptor, enumClass: IrClass): IrProperty { val entrySymbol = fundCorrespondingEnumEntrySymbol(propertyDescriptor, enumClass) return createProperty(propertyDescriptor).also { postLinkageSteps.add {<|endoftext|>
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T: SameUserInterface> testTypeParameterWithTypeAliasedUpperBoundsCReverse(arg: Invariant<T>) {}
@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T> testTypeParameterWithMultipleIdenticalUpperBoundsAA() where T: UserInterfaceA, T: UserInterfaceB {} fun <T> testTypeParameterWithMultipleIdenticalUpperBoundsAA() where T: UserInterfaceA, T: UserInterfaceB {}<|endoftext|>
import org.jetbrains.kotlin.load.java.structure.impl.JavaElementImpl import org.jetbrains.kotlin.resolve.source.PsiSourceElement private class JavaSourceElementImpl(override val javaElement: JavaElement) : PsiSourceElement, JavaSourceElement { override val psi: PsiElement?
get() = (javaElement as? JavaElementImpl<*>)?.psi } class JavaSourceElementFactoryImpl : JavaSourceElementFactory { override fun source(javaElement: JavaElement): JavaSourceElement = JavaSourceElementImpl(javaElement) }<|endoftext|>
* Will print the name of a konanTarget once a new KotlinNativeTarget was created */ internal fun interface KotlinTargetSideEffect { operator fun invoke(target: KotlinTarget) companion object { val extensionPoint = KotlinGradlePluginExtensionPoint<KotlinTargetSideEffect>() } } /** * see [KotlinTargetSideEffect] */
internal inline fun <reified T : KotlinTarget> KotlinTargetSideEffect(crossinline effect: (T) -> Unit) = KotlinTargetSideEffect { target -> if (target is T) effect(target) } internal fun KotlinTarget.runKotlinTargetSideEffects() { KotlinTargetSideEffect.extensionPoint[project].forEach { effect -> effect(this) }<|endoftext|>
incremental = true, logLevel = LogLevel.DEBUG, ) ) { val jsonReport = projectPath.getSingleFileInDir("report") val buildExecutionData = readJsonReport(jsonReport) val buildOperationRecords = buildExecutionData.buildOperationRecord.first { it.path == ":compileKotlin" } as BuildOperationRecordImpl
assertEquals(KotlinVersion.DEFAULT, buildOperationRecords.kotlinLanguageVersion) } } } @DisplayName("build report should not be overridden") @GradleTest fun testMultipleRuns(gradleVersion: GradleVersion) { project( "simpleProject", gradleVersion, buildOptions = defaultBuildOptions.copy(<|endoftext|>
interface EmptyI<caret>nterface : MarkerInterface1, MarkerInterface2, MarkerInterface3 interface MarkerInterface1 interface MarkerInterface2 : InterfaceWithMembers1 interface MarkerInterface3 : InterfaceWithMembers2 interface InterfaceWithMembers1 : AnotherSuperInterface { val property: Int fun functionWithDefaultImplementation(i: Int): Int = i override fun baseFunction()
override fun baz() { // default implementation } } interface AnotherSuperInterface { fun baz() fun baseFunction() } interface InterfaceWithMembers2 { fun foo() }<|endoftext|>
} private class ScopeWithClassifiers(classifiers: List<ClassifierDescriptor>) : MemberScopeImpl() { private val classifierMap = HashMap<Name, ClassifierDescriptor>() init { for (classifier in classifiers) { classifierMap.put(classifier.name, classifier)?.let { throw IllegalStateException( String.format(
"Redeclaration: %s (%s) and %s (%s) (no line info available)", DescriptorUtils.getFqName(it), it, DescriptorUtils.getFqName(classifier), classifier ) ) } } }<|endoftext|>
val parentName = element.symbol.owner.parentClassOrNull?.fqName if (parentName == "kotlin.Enum") { // must create a copy here to avoid original data corruption val constructorCallCopy = element.shallowCopy() val enumObject = environment.callStack.loadState(element.getThisReceiver())
environment.irBuiltIns.enumClass.owner.declarations.filterIsInstance<IrProperty>().forEachIndexed { index, it -> val field = enumObject.getField(it.symbol) as Primitive<*> constructorCallCopy.putValueArgument(index, field.value.toIrConst(field.type)) } return unfoldValueParameters(constructorCallCopy, environment)<|endoftext|>
fun case_3(x: Class?) { val y = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.reflect.KFunction1<Class, kotlin.Function1<kotlin.Int, kotlin.Function1<kotlin.Int, kotlin.Int>>>?")!>if (x != null) Class::fun_1 else null<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.reflect.KFunction1<Class, kotlin.Function1<kotlin.Int, kotlin.Function1<kotlin.Int, kotlin.Int>>>?")!>y<!> } /* * TESTCASE NUMBER: 4 * ISSUES: KT-17386 */<|endoftext|>
* In other words: "overloadable" mismatches * * @see ExpectActualCheckingCompatibility */ sealed class ExpectActualMatchingCompatibility : ExpectActualCompatibility<Nothing> { sealed class Mismatch(override val reason: String?) : ExpectActualMatchingCompatibility(), ExpectActualCompatibility.MismatchOrIncompatible<Nothing>
object CallableKind : Mismatch("callable kinds are different (function vs property)") object ActualJavaField : Mismatch("actualization to Java field is prohibited") object ParameterShape : Mismatch("parameter shapes are different (extension vs non-extension)") object ParameterCount : Mismatch("number of value parameters is different")<|endoftext|>
import org.jetbrains.kotlin.codegen.range.forLoop.ForLoopGenerator import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.psi.KtDestructuringDeclaration import org.jetbrains.kotlin.psi.KtForExpression
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall class CharSequenceWithIndexRangeValue(rangeCall: ResolvedCall<out CallableDescriptor>) : AbstractDestructuredPairRangeValue(rangeCall) { override fun createDestructuredPairForLoopGenerator( codegen: ExpressionCodegen, forExpression: KtForExpression,<|endoftext|>
override val size: Int get() = throw UnsupportedOperationException() override fun contains(element: E): Boolean { throw UnsupportedOperationException() } override fun containsAll(elements: Collection<E>): Boolean { throw UnsupportedOperationException() } override fun get(index: Int): E { throw UnsupportedOperationException() }
override fun indexOf(element: E): Int { throw UnsupportedOperationException() } override fun isEmpty(): Boolean { throw UnsupportedOperationException() } override fun lastIndexOf(element: E): Int { throw UnsupportedOperationException() } override fun iterator(): MutableIterator<E> { throw UnsupportedOperationException() }<|endoftext|>
val (classSymbol, constructorSymbol) = when { firClassSymbol?.origin == FirDeclarationOrigin.Source -> { /** * If @IntrinsicConstEvaluation is present in sources, then we are compiling stdlib and there is no need to create IrClass * for it manually, as we will create it from the source FIR class */
val irClassSymbol = c.classifierStorage.getIrClassSymbol(firClassSymbol) val firConstructor = firClassSymbol.fir.constructors(session).single() val irConstructorSymbol = c.declarationStorage.getIrConstructorSymbol(firConstructor, potentiallyExternal = false) irClassSymbol to irConstructorSymbol }<|endoftext|>
* - DEBUGGING_SYMBOLS - If YES, the debug support will be enabled for all artifacts. This option has less * priority than explicitly specified enableDebug option in the build script and * enableDebug project property. * * - KONAN_ENABLE_OPTIMIZATIONS - If YES, optimizations will be enabled for all artifacts by default. This option
* has less priority than explicitly specified enableOptimizations option in the * build script. * * Support for environment variables should be explicitly enabled by setting a project property: * konan.useEnvironmentVariables = true. */ internal interface EnvironmentVariables { val configurationBuildDir: File? val debuggingSymbols: Boolean val enableOptimizations: Boolean }<|endoftext|>
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.* import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
import org.jetbrains.kotlin.cli.jvm.config.JvmModulePathRoot import org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem import org.jetbrains.kotlin.config.* import org.jetbrains.kotlin.utils.KotlinPaths import org.jetbrains.kotlin.utils.PathUtil<|endoftext|>
fun getSuperClassBySuperTypeListEntry(specifier: KtSuperTypeListEntry, bindingContext: BindingContext): ClassDescriptor? { val superType = bindingContext.get(BindingContext.TYPE, specifier.typeReference!!) return superType?.constructor?.declarationDescriptor as? ClassDescriptor } @JvmStatic
fun getLineNumberForElement(statement: PsiElement, markEndOffset: Boolean): Int? { val file = statement.containingFile if (file is KtFile && file.doNotAnalyze != null) { return null } if (statement is KtConstructorDelegationReferenceExpression && statement.textLength == 0) {<|endoftext|>
ANNOTATION_OPTION_NAME, "<fqname>", "Annotation qualified names", required = false, allowMultipleOccurrences = true ) val PRESET_OPTION = CliOption( "preset", "<name>", "Preset name (${SUPPORTED_PRESETS.keys.joinToString()})", required = false, allowMultipleOccurrences = true )
} override val pluginId = AllOpenPluginNames.PLUGIN_ID override val pluginOptions = listOf(ANNOTATION_OPTION, PRESET_OPTION) override fun processOption(option: AbstractCliOption, value: String, configuration: CompilerConfiguration) = when (option) { ANNOTATION_OPTION -> configuration.appendList(ANNOTATION, value)<|endoftext|>
open val pressure: Float open val tangentialPressure: Float open val tiltX: Int open val tiltY: Int open val twist: Int open val pointerType: String open val isPrimary: Boolean companion object { val NONE: Short val CAPTURING_PHASE: Short val AT_TARGET: Short
val BUBBLING_PHASE: Short } }<|endoftext|>
override fun accept(visitor: InstructionVisitor) = visitor.visitMerge(this) override fun <R> accept(visitor: InstructionVisitorWithResult<R>): R = visitor.visitMerge(this) override fun createCopy() = MergeInstruction(element, blockScope, inputValues).setResult(resultValue)
override fun toString() = renderInstruction("merge", render(element)) }<|endoftext|>
yield(def(op, nullable)) } val f_foldIndexed = fn("foldIndexed(initial: R, operation: (index: Int, acc: R, T) -> R)") { includeDefault() include(CharSequences) include(ArraysOfUnsigned) } builder { inline()
specialFor(ArraysOfUnsigned) { inlineOnly() } doc { """ Accumulates value starting with [initial] value and applying [operation] from left to right to current accumulator value and each ${f.element} with its index in the original ${f.collection}. Returns the specified [initial] value if the ${f.collection} is empty.<|endoftext|>
val callInfo = generateCallInfo(callSite, name, argumentList, callKind, resolutionMode) val candidate = generateCandidate(callInfo, function, context) val applicability = components.resolutionStageRunner.processCandidate(candidate, context) val source = callSite.source?.fakeElement(KtFakeSourceElementKind.SyntheticCall) if (!candidate.isSuccessful) {
return createErrorReferenceWithExistingCandidate( candidate, ConeInapplicableCandidateError(applicability, candidate), source, context, components.resolutionStageRunner ) } return FirNamedReferenceWithCandidate(source, name, candidate) }<|endoftext|>
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE fun foo() {} fun foo(s: Int) {} fun bar(a: Any) {} fun bar(a: Int) {} fun test() { <!NONE_APPLICABLE!>foo<!>(1, 2)
foo(<!ARGUMENT_TYPE_MISMATCH!>""<!>) bar(1, <!TOO_MANY_ARGUMENTS!>2<!>) <!NONE_APPLICABLE!>bar<!>() }<|endoftext|>
} catch (e: MyException) { return "fail1" } finally { return executionType.name } } return "fail" } fun nonLocalNested(): String { synchronized(mutex) { try { try { underMutexFun() throw MyException(executionType.name)
} catch (e: MyException) { return "fail1" } finally { return executionType.name } } finally { val p = 1 + 1 } } return "fail" } } fun testTemplate(type: ExecutionType, producer: (Int) -> Callable<String>): String { try {<|endoftext|>
} else { buildAnnotation { annotationTypeRef = annotationData.annotationTypeRef argumentMapping = annotationData.argumentsMapping this.source = source } } } private class AnnotationData(val annotationTypeRef: FirResolvedTypeRef, val argumentsMapping: FirAnnotationArgumentMapping) private fun buildFirAnnotation(
javaAnnotation: JavaAnnotation, session: FirSession, source: KtSourceElement?, ): AnnotationData { val classId = javaAnnotation.classId val lookupTag = when (classId) { JvmStandardClassIds.Annotations.Java.Target -> StandardClassIds.Annotations.Target<|endoftext|>
* Returns true if the class symbol has a type parameter that is supposed to be provided for its parent class. * * Example: * class Outer<T> { * inner class Inner // Inner has an implicit type parameter `T`. * } */ private fun FirClassLikeSymbol<*>.hasTypeParameterFromParent(): Boolean = typeParameterSymbols.orEmpty().any {
it.containingDeclarationSymbol != this } private fun FirScope.correspondingClassIdIfExists(): ClassId = when (this) { is FirNestedClassifierScope -> klass.classId is FirNestedClassifierScopeWithSubstitution -> originalScope.correspondingClassIdIfExists() is FirClassUseSiteMemberScope -> ownerClassLookupTag.classId<|endoftext|>
}, { x: Int, <!CANNOT_INFER_PARAMETER_TYPE!>y<!> -> })
val x2 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>select<!>(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id<!> { x, <!CANNOT_INFER_PARAMETER_TYPE!>y<!> -><|endoftext|>
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>() } } fun poll13(flag: Boolean): Flow<String> { return flow {
val inv = if (flag) { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar2<!><!><|endoftext|>
package androidx.compose.compiler.plugins.kotlin.k2 import androidx.compose.compiler.plugins.kotlin.ComposeClassIds import org.jetbrains.kotlin.fir.FirAnnotationContainer import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.getAnnotationStringParameter import org.jetbrains.kotlin.fir.analysis.checkers.unsubstitutedScope import org.jetbrains.kotlin.fir.containingClassLookupTag<|endoftext|>
fun cond() = true inline fun <reified T : Base, reified Y : Base> process(a: Base) { val z = if (cond()) arrayOf<T>(a as T) else arrayOf<Y>(a as Y) foo(z) } // FILE: 2.kt import test.* fun box(): String {
process<A, B>(A("OK")) return result }<|endoftext|>
private fun ScriptDiagnostic.Severity.convertSeverity(): CompilerMessageSeverity = when (this) { ScriptDiagnostic.Severity.FATAL -> CompilerMessageSeverity.ERROR ScriptDiagnostic.Severity.ERROR -> CompilerMessageSeverity.ERROR ScriptDiagnostic.Severity.WARNING -> CompilerMessageSeverity.WARNING
ScriptDiagnostic.Severity.INFO -> CompilerMessageSeverity.INFO ScriptDiagnostic.Severity.DEBUG -> CompilerMessageSeverity.LOGGING } }<|endoftext|>
val descriptor = context.get(DECLARATION_TO_DESCRIPTOR, (this as? KtClassInitializer)?.containingDeclaration ?: this) return if (descriptor is ClassDescriptor && this is KtClassInitializer) { // For a class primary constructor, we cannot directly get ConstructorDescriptor by KtClassInitializer,
// so we have to do additional conversion: KtClassInitializer -> KtClassOrObject -> ClassDescriptor -> ConstructorDescriptor descriptor.unsubstitutedPrimaryConstructor ?: (descriptor as? ClassDescriptorWithResolutionScopes)?.scopeForInitializerResolution?.ownerDescriptor } else { descriptor } }<|endoftext|>
Type.CHAR to it, Type.UINT to it, Type.ULONG to TestBuilder(1 to 9).step("two().toLong()").expectValues(1, 3, 5, 7), ) }, Function.UNTIL, extraCode = "fun two() = 2" ) generateTestsForFunction( "stepNonConst.kt",
TestBuilder(8 to 1).step("two()").expectValues(8, 6, 4, 2).let { mapOf( // Argument for (U)LongProgression.step() must be a Long Type.INT to it, Type.LONG to TestBuilder(8 to 1).step("two().toLong()").expectValues(8, 6, 4, 2),<|endoftext|>
@Argument(value = "-Xir-per-file", description = "Generate one .js file per source file.") var irPerFile = false set(value) { checkFrozen() field = value } @Argument(value = "-Xir-new-ir2js", description = "New fragment-based 'ir2js'.") var irNewIr2Js = true
set(value) { checkFrozen() field = value } @Argument( value = "-Xir-generate-inline-anonymous-functions", description = "Lambda expressions that capture values are translated into in-line anonymous JavaScript functions." ) var irGenerateInlineAnonymousFunctions = false set(value) { checkFrozen()<|endoftext|>
fun getType(container: ObjCClassOrProtocol): Type = getter.getReturnType(container) } abstract class ObjCClass(name: String) : ObjCClassOrProtocol(name) { abstract val binaryName: String? abstract val baseClass: ObjCClass? /** * Categories whose methods and properties should be generated as members of Kotlin class. */
abstract val includedCategories: List<ObjCCategory> } abstract class ObjCProtocol(name: String) : ObjCClassOrProtocol(name) abstract class ObjCCategory(val name: String, val clazz: ObjCClass) : ObjCContainer(), LocatableDeclaration /** * C function parameter. */<|endoftext|>
<!USELESS_IS_CHECK!>d !is <!DYNAMIC_NOT_ALLOWED!>dynamic?<!><!> when (d) { <!USELESS_IS_CHECK!>is <!DYNAMIC_NOT_ALLOWED!>dynamic<!><!> -> {}
<!USELESS_IS_CHECK!>is <!DUPLICATE_BRANCH_CONDITION_IN_WHEN, DYNAMIC_NOT_ALLOWED!>dynamic?<!><!> -> {} <!USELESS_IS_CHECK!>!is <!DYNAMIC_NOT_ALLOWED!>dynamic<!><!> -> {}<|endoftext|>
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalStdlibApi::class}) public final operator fun rangeUntil(other: kotlin.Long): kotlin.ranges.LongRange @kotlin.SinceKotlin(version = "1.9")
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalStdlibApi::class}) public final operator fun rangeUntil(other: kotlin.Short): kotlin.ranges.IntRange @kotlin.SinceKotlin(version = "1.1") @kotlin.internal.IntrinsicConstEvaluation<|endoftext|>
const val minus8 = twoVal.<!EVALUATED("0.0")!>minus(doubleVal)<!> const val times1 = oneVal.<!EVALUATED("2")!>times(twoVal)<!> const val times2 = twoVal.<!EVALUATED("4")!>times(twoVal)<!>
const val times3 = threeVal.<!EVALUATED("6")!>times(twoVal)<!> const val times4 = twoVal.<!EVALUATED("4")!>times(byteVal)<!> const val times5 = twoVal.<!EVALUATED("4")!>times(shortVal)<!><|endoftext|>
(declaration.parent as? IrClass)?.let { irClass -> if (!irClass.isEnumClass || irClass.isExpect || irClass.isEffectivelyExternal()) return null if (declaration is IrConstructor) { // Add `name` and `ordinal` parameters to enum class constructors return listOf(transformEnumConstructor(declaration, irClass)) }
if (declaration is IrEnumEntry) { declaration.correspondingClass?.let { klass -> klass.correspondingEntry = declaration } } } return null } private fun transformEnumConstructor(enumConstructor: IrConstructor, enumClass: IrClass): IrConstructor { return context.irFactory.buildConstructor {<|endoftext|>
i2.foo2({}, x2, <!ARGUMENT_TYPE_MISMATCH!><!CANNOT_INFER_PARAMETER_TYPE!>arrayOf<!>()<!>) i2.foo2(x2, {}, *arrayOf()) i2.foo2({}, {}, <!ARGUMENT_TYPE_MISMATCH!>arrayOf("")<!>)
i2.foo2({}, {}, *x3) i2.foo2({}, x2, <!ARGUMENT_TYPE_MISMATCH!>x3<!>) i2.foo2(x2, {}, *arrayOf("")) }<|endoftext|>
// FIR_IDENTICAL // !OPT_IN: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: api.kt package api @RequiresOptIn(level = RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS,
AnnotationTarget.VALUE_PARAMETER) @Retention(AnnotationRetention.BINARY) annotation class ExperimentalAPI @ExperimentalAPI fun function(): String = "" @ExperimentalAPI val property: String = "" @ExperimentalAPI typealias Typealias = String // FILE: usage-propagate.kt package usage1 import api.* @ExperimentalAPI<|endoftext|>
if (!isNotEqualAnyNullableLeft(A(Inner("")), "")) return "Fail 22" if (!isNotEqualAnyNullableLeft<Inner<String>>(null, Inner(""))) return "Fail 23" if (!isNotEqualAnyNullableLeft(A(Inner("")), null)) return "Fail 24"
if (!isNotEqualAnyNullableLeft(A(Inner("")), A(Inner("a")))) return "Fail 25" if (isNotEqualAnyNullableRight<Inner<String>>(null, null)) return "Fail 26" if (isNotEqualAnyNullableRight(A(Inner("a")), A(Inner("a")))) return "Fail 27"<|endoftext|>
val gs = (eval("B\$gar\$lambda").toString() as String).replaceAll("boo", "foo").replaceAll("gar", "far") assertEquals(gs, fs) return "OK" } // Helpers inline fun String.replace(regexp: RegExp, replacement: String): String = asDynamic().replace(regexp, replacement)
fun String.replaceAll(regexp: String, replacement: String): String = replace(RegExp(regexp, "g"), replacement) external class RegExp(regexp: String, flags: String)<|endoftext|>
elementsToReorder.sortedBy { normalOrdering[it.getAttribute("name")?.value!!] } .forEachIndexed { index, element -> elementsToReorder[index] = element.clone() } } private fun buildChildElement(element: Element, tag: String, bean: Any, filter: SerializationFilter): Element { return Element(tag).apply {
XmlSerializer.serializeInto(bean, this, filter) restoreNormalOrdering(bean) element.addContent(this) } } private fun KotlinFacetSettings.writeConfig(element: Element) { val filter = SkipDefaultsSerializationFilter()<|endoftext|>
// JVM_IR_TEMPLATES // VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=3 // VARIABLE : NAME=y_param TYPE=I INDEX=4 // VARIABLE : NAME=this TYPE=LGenericKt$test$2; INDEX=0
// VARIABLE : NAME=$result TYPE=Ljava/lang/Object; INDEX=1<|endoftext|>
import lombok.*; import java.util.*; public class ChildClass extends ClashTest{ @Override public Integer getToOverride() { return super.getToOverride(); } } // FILE: test.kt class KotlinChildClass : ClashTest() { override fun getToOverride(): Int? = super.getToOverride() }
fun test() { val obj = ClashTest() obj.getAge() //thats shouldn't work because lombok doesn't generate clashing method obj.setAge(<!ARGUMENT_TYPE_MISMATCH!>41<!>) obj.<!VAL_REASSIGNMENT!>age<!> = 12 val age = obj.age<|endoftext|>
val implFunRef = expression.getValueArgument(1) as? IrFunctionReference ?: throw AssertionError("'implMethodReference' is expected to be 'IrFunctionReference': ${expression.dump()}") val implFun = implFunRef.symbol.owner if (implFunRef.dispatchReceiver != null && implFun is IrSimpleFunction && shouldReplaceWithStaticCall(implFun)) {
val (staticProxy, _) = context.cachedDeclarations.getStaticAndCompanionDeclaration(implFun) expression.putValueArgument( 1, IrFunctionReferenceImpl( implFunRef.startOffset, implFunRef.endOffset, implFunRef.type, staticProxy.symbol, staticProxy.typeParameters.size, staticProxy.valueParameters.size,<|endoftext|>
if (d != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>d<!>.funT()
if (d != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>d<!>.funAny() if (d != null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>d<!>.funNullableT()<|endoftext|>
return if (binaryLogicExpression.kind == LogicOperationKind.AND) { visitLogicalAnd(binaryLogicExpression, data) } else { visitLogicalOr(binaryLogicExpression, data) } } private fun visitLogicalOr(logicalOr: ConeBinaryLogicExpression, data: Unit): ProtoBuf.Expression.Builder {
val leftBuilder = logicalOr.left.accept(this, data) return if (leftBuilder.andArgumentCount != 0) { // can't flatten and re-use left builder ProtoBuf.Expression.newBuilder().apply { addOrArgument(leftBuilder) addOrArgument(contractExpressionProto(logicalOr.right, contractDescription)) }<|endoftext|>
// !DIAGNOSTICS: -UNUSED_PARAMETER interface C<out T> interface MC<T> : C<T> { fun addAll(x: C<T>): Boolean fun addAllMC(x: MC<out T>): Boolean fun addAllInv(x: MC<T>): Boolean } interface Open class Derived : Open
fun <T> mc(): MC<T> = null!! fun <T> c(): C<T> = null!! fun foo(x: MC<out Open>) { x.addAll(<!TYPE_MISMATCH!>x<!>) x.addAllMC(<!TYPE_MISMATCH!>x<!>)<|endoftext|>
}.prepareForEvaluateScriptFunction(it) ) } with(irScript) { statements.removeIf { it !is IrDeclaration } statements += initializeScriptFunction initializeScriptFunction.patchDeclarationParents(this) statements += evaluateScriptFunction evaluateScriptFunction.patchDeclarationParents(this) statements += createCall(initializeScriptFunction)
statements += createCall(evaluateScriptFunction) } return listOf(irScript) } private fun getFunctionBodyOffsets(irScript: IrScript): Pair<Int, Int> { return with(irScript.statements) { if (isEmpty()) { Pair(UNDEFINED_OFFSET, UNDEFINED_OFFSET) } else {<|endoftext|>
for (i in 0..x) { val s = buildString { for (j in 0..y) { appendLine("${i * j}") } } takeString(s) } } localFunc() } fun box(): String { test() return if (result == 3025) "OK" else "Fail: $result"
}<|endoftext|>
val kotlinLines = mutableListOf<String>() val nativeLines = mutableListOf<String>() val kotlinFunctionName = "kniBridge${nextUniqueId++}" val kotlinParameters = nativeValues.withIndex().map { "p${it.index}" to it.value.type.kotlinType }
val joinedKotlinParameters = kotlinParameters.joinToString { "${it.first}: ${it.second.render(topLevelKotlinScope)}" } val cFunctionParameters = nativeValues.withIndex().map { "p${it.index}" to it.value.type.nativeType }<|endoftext|>
open class F: AIB(), IK // B, C open class G: E(), IL, IE // B, C, E, I val an = Any() val a = A() val aia = AIA() val aib = AIB() val aie = AIE() val aif = AIF() val aij = AIJ() val baia = BAIA()
val baiaif = BAIAIF() val baiaij = BAIAIJ() val c = C() val cib = CIB() val d = D() val e = E() val f = F() val g = G() var dyn = js("({})") fun dToNB(dd: dynamic) = dd as? IB? fun dToB(dd: dynamic) = dd as? IB<|endoftext|>
public interface UnannotatedType { public String unannotatedProduce(); public void unannotatedConsume(String arg); } // FILE: unannotatedpackage/ConflictinglyAnnotatedType.java package unannotatedpackage; import org.jspecify.annotations.*; @NullUnmarked @NullMarked public interface ConflictinglyAnnotatedType {
public String unannotatedProduce(); public void unannotatedConsume(String arg); } // FILE: unannotatedpackage/UnannotatedType.java package unannotatedpackage; import org.jspecify.annotations.*; public interface UnannotatedType { @NullUnmarked @NullMarked public String conflictinglyAnnotatedProduce();<|endoftext|>
val parameter = addValueParameter { name = closureClassField.name type = closureClassField.type } body = context.createIrBuilder(symbol).irBlockBody(startOffset, endOffset) { +irDelegatingConstructorCall(context.irBuiltIns.anyClass.owner.constructors.single())
+irSetField(irGet(closureClass.thisReceiver!!), closureClassField, irGet(parameter)) +IrInstanceInitializerCallImpl(startOffset, endOffset, closureClass.symbol, context.irBuiltIns.unitType) } } closureClass.addFunction { name = Name.identifier("invoke") returnType = info.originalResultType }.apply {<|endoftext|>
import org.jetbrains.kotlin.js.resolve.diagnostics.JsCallChecker.Companion.isJsCall import org.jetbrains.kotlin.js.resolve.diagnostics.findPsi import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.resolve.TemporaryBindingTrace
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker import org.jetbrains.kotlin.resolve.calls.checkers.CallCheckerContext import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator<|endoftext|>
fun analyze(): Map<DataFlowIR.FunctionSymbol, FunctionAnalysisResult> { val nothing = moduleDFG.symbolTable.mapClassReferenceType(context.ir.symbols.nothing.owner).resolved() return callGraph.nodes.filter { functions[it.symbol] != null }.associateBy({ it.symbol }) { callGraphNode ->
val function = functions[callGraphNode.symbol]!! val body = function.body val nodesRoles = mutableMapOf<DataFlowIR.Node, NodeInfo>() fun computeDepths(node: DataFlowIR.Node, depth: Int) { if (node is DataFlowIR.Node.Scope) node.nodes.forEach { computeDepths(it, depth + 1) }<|endoftext|>
"getBytes(Ljava/lang/String;)[B", "getBytes(Ljava/nio/charset/Charset;)[B", "getChars(II[CI)V", "indexOf(I)I", "indexOf(II)I", "indexOf(Ljava/lang/String;)I", "indexOf(Ljava/lang/String;I)I",
"intern()Ljava/lang/String;", "isEmpty()Z", "lastIndexOf(I)I", "lastIndexOf(II)I", "lastIndexOf(Ljava/lang/String;)I", "lastIndexOf(Ljava/lang/String;I)I", "matches(Ljava/lang/String;)Z",<|endoftext|>
// At this moment we do not take initializer value into account if type is given for a property // We can comment this condition to take them into account, like here: var s: String? = "xyz" // In this case s will be not-nullable until it is changed if (property.typeReference == null) { val variableDataFlowValue = dataFlowValueFactory.createDataFlowValueForProperty(
property, propertyDescriptor, context.trace.bindingContext, DescriptorUtils.getContainingModuleOrNull(scope.ownerDescriptor) ) // We cannot say here anything new about initializerDataFlowValue // except it has the same value as variableDataFlowValue typeInfo = typeInfo.replaceDataFlowInfo( dataFlowInfo.assign(<|endoftext|>
// FIR_IDENTICAL // ISSUE: KT-66463 // JVM_TARGET: 1.8 // SCOPE_DUMP: B:get // FILE: A.java public abstract class A implements CharSequence { public final int length() { return 0; } public final char charAt(int index) { return 'K'; }
public final CharSequence subSequence(int startIndex, int endIndex) { return this; } public abstract char get(int index); } // FILE: Proxy.java public interface Proxy { default char get(int index) { return ' '; } } // FILE: B.kt class B : A(), Proxy {<|endoftext|>
val boundsSymbols = bounds.mapNotNull { it.toClassSymbol(session) } return TypeInfo( type, notNullType, directType = this, isEnumClass = boundsSymbols.any { it.isEnumClass }, isPrimitive = bounds.any { it.isPrimitiveOrNullablePrimitive },
isBuiltin = boundsSymbols.any { it.isBuiltin }, isValueClass = boundsSymbols.any { it.isInline }, isFinal = boundsSymbols.any { it.isFinalClass }, isClass = boundsSymbols.any { it.isClass }, // In K1's intersector, `canHaveSubtypes()` is called for `nullabilityStripped`.<|endoftext|>
private lateinit var existingInfosPerFile: Map<TestFile, List<ParsedCodeMetaInfo>> private val infosPerFile: MutableMap<TestFile, MutableList<CodeMetaInfo>> = mutableMapOf<TestFile, MutableList<CodeMetaInfo>>().withDefault { mutableListOf() }
private val existingInfosPerFilePerInfoCache = mutableMapOf<Pair<TestFile, CodeMetaInfo>, List<ParsedCodeMetaInfo>>() @OptIn(ExperimentalStdlibApi::class) fun parseExistingMetadataInfosFromAllSources() { existingInfosPerFile = buildMap {<|endoftext|>
} // Case: Invalid inheritance. is Unusable.InvalidInheritance -> { when (rootCause.superClassSymbols.size) { // Subcase: Invalid super class. 1 -> { fun Appendable.inheritsFromSuperClass(): Appendable { val superClassSymbol = rootCause.superClassSymbols.single()
if (superClassSymbol.owner.modality == Modality.FINAL) append(" inherits from final ") else append(" has illegal inheritance from ") return declarationKindName(superClassSymbol, capitalized = false) } when (rendering) { CauseRendering.Standalone -> subject(capitalized = true).inheritsFromSuperClass()<|endoftext|>
OperatorNameConventions.CONTAINS to IrStatementOrigin.IN, ) internal fun FirReference.statementOrigin(): IrStatementOrigin? = when (this) { is FirPropertyFromParameterResolvedNamedReference -> IrStatementOrigin.INITIALIZE_PROPERTY_FROM_PARAMETER is FirResolvedNamedReference -> when (val symbol = resolvedSymbol) {
is FirSyntheticPropertySymbol -> IrStatementOrigin.GET_PROPERTY is FirNamedFunctionSymbol -> when { symbol.callableId.isInvoke() -> IrStatementOrigin.INVOKE source?.kind == KtFakeSourceElementKind.DesugaredForLoop && symbol.callableId.isIteratorNext() -> IrStatementOrigin.FOR_LOOP_NEXT<|endoftext|>
// WITH_STDLIB // CHECK_CASES_COUNT: function=foo1 count=0 TARGET_BACKENDS=JS // CHECK_CASES_COUNT: function=foo1 count=4 IGNORED_BACKENDS=JS // CHECK_IF_COUNT: function=foo1 count=2 TARGET_BACKENDS=JS
// CHECK_IF_COUNT: function=foo1 count=0 IGNORED_BACKENDS=JS // CHECK_CASES_COUNT: function=foo2 count=0 TARGET_BACKENDS=JS // CHECK_CASES_COUNT: function=foo2 count=3 IGNORED_BACKENDS=JS<|endoftext|>
val MASK_FOR_DEFAULT_FUNCTION by IrDeclarationOriginImpl.Synthetic val DEFAULT_CONSTRUCTOR_MARKER by IrDeclarationOriginImpl.Synthetic val METHOD_HANDLER_IN_DEFAULT_FUNCTION by IrDeclarationOriginImpl.Synthetic val MOVED_DISPATCH_RECEIVER by IrDeclarationOriginImpl
val MOVED_EXTENSION_RECEIVER by IrDeclarationOriginImpl val MOVED_CONTEXT_RECEIVER by IrDeclarationOriginImpl val FILE_CLASS by IrDeclarationOriginImpl val SYNTHETIC_FILE_CLASS by IrDeclarationOriginImpl.Synthetic val JVM_MULTIFILE_CLASS by IrDeclarationOriginImpl<|endoftext|>
private fun checkExpectedClassConstructor(constructorDescriptor: ClassConstructorDescriptor, declaration: KtConstructor<*>) { if (!constructorDescriptor.isExpect) return if (declaration.hasBody()) { trace.report(EXPECTED_DECLARATION_WITH_BODY.on(declaration)) }
if (constructorDescriptor.containingDeclaration.kind == ClassKind.ENUM_CLASS) { trace.report(EXPECTED_ENUM_CONSTRUCTOR.on(declaration)) } if (declaration is KtPrimaryConstructor && !DescriptorUtils.isAnnotationClass(constructorDescriptor.constructedClass) &&<|endoftext|>
<!JS_NAME_IS_NOT_ON_ALL_ACCESSORS!>var xx: Int<!> @JsName("get_xx") get() = 23 set(<!UNUSED_PARAMETER!>value<!>) {} <!JS_NAME_IS_NOT_ON_ALL_ACCESSORS!>var A.ext: Int<!>
@JsName("get_ext") get() = 23 set(<!UNUSED_PARAMETER!>value<!>) {}<|endoftext|>
Modality.FINAL -> PsiModifier.FINAL Modality.ABSTRACT -> PsiModifier.ABSTRACT Modality.OPEN -> null } context(KtAnalysisSession) internal fun KtClassOrObjectSymbol.enumClassModality(): String? {
if (getMemberScope().getCallableSymbols().any { (it as? KtSymbolWithModality)?.modality == Modality.ABSTRACT }) { return PsiModifier.ABSTRACT } if (getStaticDeclaredMemberScope().getCallableSymbols().none { it is KtEnumEntrySymbol && it.requiresSubClass() }) {<|endoftext|>
class B() {} fun foo(i: Int) = i fun B.ext() {} val value = 0 class C() { companion object { fun bar() {} val cValue = 1 } } class D() { fun fff(s: String) = s val dValue = "w" } val constant = D()
class E() { companion object { val f = F() } } class F() { fun f() {} } fun bar() {} //FILE:c.kt package c import c.<!CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON!>C<!>.* object C { fun f() { }<|endoftext|>
isMutable: Boolean = false ): Pair<IrVariable?, IrExpression> = if (expression.canChangeValueDuringExecution) { scope.createTmpVariable(expression, nameHint = nameHint, irType = irType, isMutable = isMutable).let { Pair(it, irGet(it)) } } else { Pair(null, expression) }
internal fun IrExpression.castIfNecessary(targetClass: IrClass) = when { // This expression's type could be Nothing from an exception throw. type == targetClass.defaultType || type.isNothing() -> this this is IrConst<*> && targetClass.defaultType.isPrimitiveType() -> { // TODO: convert unsigned too? val targetType = targetClass.defaultType<|endoftext|>
get() = this == OBJECT || this == ENUM_ENTRY } inline val ClassKind.isClass: Boolean get() = this == ClassKind.CLASS inline val ClassKind.isInterface: Boolean get() = this == ClassKind.INTERFACE inline val ClassKind.isEnumClass: Boolean get() = this == ClassKind.ENUM_CLASS
inline val ClassKind.isEnumEntry: Boolean get() = this == ClassKind.ENUM_ENTRY inline val ClassKind.isAnnotationClass: Boolean get() = this == ClassKind.ANNOTATION_CLASS inline val ClassKind.isObject: Boolean get() = this == ClassKind.OBJECT<|endoftext|>
override val inlineClassesUtils = JsInlineClassesUtils(this) override val innerClassesSupport: InnerClassesSupport = JsInnerClassesSupport(mapping, irFactory) companion object { val KOTLIN_PACKAGE_FQN = FqName.fromSegments(listOf("kotlin"))
// TODO: what is more clear way reference this getter? private val REFLECT_PACKAGE_FQNAME = KOTLIN_PACKAGE_FQN.child(Name.identifier("reflect")) private val JS_PACKAGE_FQNAME = KOTLIN_PACKAGE_FQN.child(Name.identifier("js"))<|endoftext|>
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM_IR // not sure if it's ok to change Object to Any // WITH_STDLIB package test.regressions.kt1172 public fun scheduleRefresh(vararg files : Object) { ArrayList<Object>(files.map { it }) } fun box(): String { scheduleRefresh()
return "OK" }<|endoftext|>
// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -NOTHING_TO_INLINE // SKIP_TXT /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
* * SPEC VERSION: 0.1-278 * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 4 * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 4 -> sentence 1<|endoftext|>
fun completed(value: String) { this.result = value } } fun box(): String { CompilerBug1("OK").result.also { if (it != "OK") return "CompilerBug1: $it" } CompilerBug2("OK").result.also { if (it != "OK") return "CompilerBug2: $it" }
CompilerBug3("OK").result.also { if (it != "OK") return "CompilerBug3: $it" } return "OK" }<|endoftext|>
// FILE: baz.kt import kotlin.reflect.* @OptIn(ExperimentalAssociatedObjects::class) @AssociatedObjectKey @Retention(AnnotationRetention.BINARY) annotation class Associated2(val kClass: KClass<*>) object Baz private class C(var list: List<String>?) private interface I1 { fun foo(): Int
fun bar(c: C) } private object I1Impl : I1 { override fun foo() = 42 override fun bar(c: C) { c.list = mutableListOf("zzz") } } @Associated1(I1Impl::class) private class I1ImplHolder private interface I2 { fun foo(): Int }<|endoftext|>
internal fun launch(outputDirectory: String, dynamicAsType: Boolean, useStaticGetters: Boolean) { val input = "../../stdlib/js/idl/org.w3c.dom.idl" val args = mutableListOf<String>() args.add("-d") args.add(outputDirectory) args.add(input)
if (dynamicAsType) { args.add("--dynamic-as-type") } if (useStaticGetters) { args.add("--use-static-getters") } org.jetbrains.dukat.cli.main(*args.toTypedArray()) for (file in File(outputDirectory).listFiles { name -><|endoftext|>
fun setPointerCapture(pointerId: Int) fun releasePointerCapture(pointerId: Int) fun hasPointerCapture(pointerId: Int): Boolean fun requestFullscreen(): Promise<Unit> companion object { val ELEMENT_NODE: Short val ATTRIBUTE_NODE: Short val TEXT_NODE: Short
val CDATA_SECTION_NODE: Short val ENTITY_REFERENCE_NODE: Short val ENTITY_NODE: Short val PROCESSING_INSTRUCTION_NODE: Short val COMMENT_NODE: Short val DOCUMENT_NODE: Short val DOCUMENT_TYPE_NODE: Short<|endoftext|>
package org.jetbrains.kotlin.serialization.deserialization.descriptors import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.storage.StorageManager
import org.jetbrains.kotlin.storage.getValue open class DeserializedAnnotations( storageManager: StorageManager, compute: () -> List<AnnotationDescriptor> ) : Annotations { private val annotations by storageManager.createLazyValue(compute) override fun isEmpty(): Boolean = annotations.isEmpty()<|endoftext|>
if (list1 != listOf<UInt>()) { return "Wrong elements for 10u..5u: $list1" } val list2 = ArrayList<UInt>() for (i in 10u.toUByte()..5u.toUByte()) { list2.add(i) if (list2.size > 23) break }
if (list2 != listOf<UInt>()) { return "Wrong elements for 10u.toUByte()..5u.toUByte(): $list2" } val list3 = ArrayList<UInt>() for (i in 10u.toUShort()..5u.toUShort()) { list3.add(i)<|endoftext|>
// FIR_IDENTICAL // JSPECIFY_STATE: warn // FILE: NullMarkedType.java import org.jspecify.annotations.*; @NullMarked public class NullMarkedType { public static class TargetType<T extends Object> { public void consume(T arg) {} @NullUnmarked
public static TargetType INSTANCE() { return new TargetType<String>(); } } } // FILE: kotlin.kt fun test() { // jspecify_nullness_mismatch NullMarkedType.TargetType.INSTANCE().consume(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)<|endoftext|>
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalUnsignedTypes::class}) @kotlin.internal.InlineOnly public inline fun kotlin.Double.toULong(): kotlin.ULong @kotlin.SinceKotlin(version = "1.5")
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalUnsignedTypes::class}) @kotlin.internal.InlineOnly public inline fun kotlin.Float.toULong(): kotlin.ULong @kotlin.SinceKotlin(version = "1.5")<|endoftext|>
with(printer) { append("DeprecationInfo(") append("deprecationLevel=${info.deprecationLevel}, ") append("propagatesToOverrides=${info.propagatesToOverrides}, ") append("message=${info.message}") append(")") } }
private fun KtAnalysisSession.renderValue(value: Any?, printer: PrettyPrinter, renderSymbolsFully: Boolean) { when (value) { // Symbol-related values is KtSymbol -> renderSymbolTag(value, printer, renderSymbolsFully) is KtType -> renderType(value, printer)<|endoftext|>
<!CONFLICTING_OVERLOADS!>@Deprecated(message = "", level = DeprecationLevel.HIDDEN) fun <T: UserInterfaceA> testTypeParameterWithMultipleShuffledUpperBoundsBA()<!> where T: UserInterfaceB {}
<!CONFLICTING_OVERLOADS!>fun <T: UserInterfaceB> testTypeParameterWithMultipleShuffledUpperBoundsBA()<!> where T: UserInterfaceA {}<|endoftext|>
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.DeclarationCheckers import org.jetbrains.kotlin.fir.analysis.checkersComponent import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.FirDoWhileLoop
import org.jetbrains.kotlin.fir.expressions.FirLoop import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression import org.jetbrains.kotlin.fir.references.toResolvedPropertySymbol import org.jetbrains.kotlin.fir.resolve.dfa.cfg.ControlFlowGraph<|endoftext|>
val DEFAULT_STATUS_FOR_STATUSLESS_DECLARATIONS = FirResolvedDeclarationStatusImpl( Visibilities.Public, Modality.FINAL, EffectiveVisibility.Public ) val DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION = FirResolvedDeclarationStatusImpl( Visibilities.Local, Modality.FINAL,
EffectiveVisibility.Public ).apply { isSuspend = true } val DEFAULT_STATUS_FOR_SUSPEND_MAIN_FUNCTION = FirResolvedDeclarationStatusImpl( Visibilities.Public, Modality.FINAL, EffectiveVisibility.Public ).apply { isSuspend = true } } internal constructor(<|endoftext|>
// DUMP_IR package bar import foo.AllOpenGenerated import org.jetbrains.kotlin.fir.plugin.ExternalClassWithNested @ExternalClassWithNested class Foo { fun box(): String { return "OK" } } fun testConstructor() { val generatedClass: AllOpenGenerated = AllOpenGenerated() }
fun testNestedClasses(): String { val nestedFoo = AllOpenGenerated.NestedFoo() return nestedFoo.materialize().box() } fun box(): String { testConstructor() return testNestedClasses() }<|endoftext|>
ValueParameterDescriptorImpl( functionDescriptor, null, i, Annotations.EMPTY, Name.identifier("p${i + 1}"), typeProjection.type, /* declaresDefaultValue = */ false, /* isCrossinline = */ false, /* isNoinline = */ false, null, SourceElement.NO_SOURCE ) } }
fun getValueParametersCountFromFunctionType(type: KotlinType): Int { assert(type.isBuiltinFunctionalType) { "Not a function type: $type" } // Function type arguments = receiver? + parameters + return-type return type.arguments.size - (if (type.isBuiltinExtensionFunctionalType) 1 else 0) - 1 }<|endoftext|>
report( RECEIVER_TYPE_MISMATCH.on( psiCall.calleeExpression ?: psiCall.callElement, error.upperKotlinType, error.lowerKotlinType ) ) } return } val deparenthesized = KtPsiUtil.safeDeparenthesize(expression)
if (reportConstantTypeMismatch(error, deparenthesized)) return val compileTimeConstant = trace[BindingContext.COMPILE_TIME_VALUE, deparenthesized] as? TypedCompileTimeConstant if (compileTimeConstant != null) { val expressionType = trace[BindingContext.EXPRESSION_TYPE_INFO, expression]?.type<|endoftext|>
import java.io.File import java.rmi.RemoteException import javax.inject.Inject private const val LOGGER_PREFIX = "[KOTLIN] " internal abstract class BuildToolsApiCompilationWork @Inject constructor( private val fileSystemOperations: FileSystemOperations, ) :
WorkAction<BuildToolsApiCompilationWork.BuildToolsApiCompilationParameters> { internal interface BuildToolsApiCompilationParameters : WorkParameters { val buildIdService: Property<BuildIdService> val buildFinishedListenerService: Property<BuildFinishedListenerService> val classLoadersCachingService: Property<ClassLoadersCachingBuildService><|endoftext|>
package org.jetbrains.kotlin.ir import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile import com.intellij.psi.util.PsiTreeUtil import kotlin.reflect.KClass class PsiIrFileEntry(val psiFile: PsiFile) : AbstractIrFileEntry() {
private val psiFileName = psiFile.virtualFile?.path ?: psiFile.name override val maxOffset: Int override val lineStartOffsets: IntArray private val fileViewProvider = psiFile.viewProvider init { val document = fileViewProvider.document ?: throw AssertionError("No document for $psiFile") maxOffset = document.textLength<|endoftext|>
return@eval ReplEvalResult.Error.Runtime(renderReplStackTrace(e.cause!!, startFromMethodName = "${scriptClass.name}.<init>"), e as? Exception) } finally { historyActor.removePlaceholder(compileResult.lineId) Thread.currentThread().contextClassLoader = savedClassLoader }
historyActor.addFinal(compileResult.lineId, EvalClassWithInstanceAndLoader(scriptClass.kotlin, scriptInstance, classLoader, invokeWrapper)) return if (compileResult.hasResult) { val resultFieldName = scriptResultFieldName(compileResult.lineId.no)<|endoftext|>
val SVG_PRESERVEASPECTRATIO_XMINYMAX: Short val SVG_PRESERVEASPECTRATIO_XMIDYMAX: Short val SVG_PRESERVEASPECTRATIO_XMAXYMAX: Short val SVG_MEETORSLICE_UNKNOWN: Short val SVG_MEETORSLICE_MEET: Short
val SVG_MEETORSLICE_SLICE: Short } } /** * Exposes the JavaScript [SVGAnimatedPreserveAspectRatio](https://developer.mozilla.org/en/docs/Web/API/SVGAnimatedPreserveAspectRatio) to Kotlin */ public external abstract class SVGAnimatedPreserveAspectRatio : JsAny {<|endoftext|>
if (e != null || <!SENSELESS_COMPARISON!>this.e != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char"), DEBUG_INFO_SMARTCAST!>this.e<!>.funAny()
if (e != null || <!SENSELESS_COMPARISON!>this.e != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char & kotlin.Char?")!>this.e<!>.funNullableT()<|endoftext|>
import org.jetbrains.kotlin.backend.jvm.ir.isCompiledToJvmDefault import org.jetbrains.kotlin.backend.jvm.lower.findInterfaceImplementation import org.jetbrains.kotlin.backend.jvm.needsMfvcFlattening import org.jetbrains.kotlin.builtins.functions.BuiltInFunctionArity
import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.ir.builders.declarations.buildClass import org.jetbrains.kotlin.ir.builders.declarations.buildValueParameter<|endoftext|>
} override fun getTextOffset(): Int = classOrObjectDeclaration?.textOffset ?: -1 override fun getStartOffsetInParent(): Int = classOrObjectDeclaration?.startOffsetInParent ?: -1 override fun isWritable() = false override fun getNavigationElement(): PsiElement = classOrObjectDeclaration ?: this
override fun isEquivalentTo(another: PsiElement?): Boolean = isEquivalentToByName(another) || isOriginEquivalentTo(another) protected fun isEquivalentToByName(another: PsiElement?): Boolean = basicIsEquivalentTo(this, another) || another is PsiClass && qualifiedName != null && another.qualifiedName == qualifiedName<|endoftext|>
val file = File(baseDir, uniqueScriptHash(script, scriptCompilationConfiguration)) return if (!file.exists()) null else file.readCompiledScript().also { retrievedScripts++ } } override fun store( compiledScript: CompiledScript, script: SourceCode, scriptCompilationConfiguration: ScriptCompilationConfiguration ) {
val file = File(baseDir, uniqueScriptHash(script, scriptCompilationConfiguration)) file.outputStream().use { fs -> ObjectOutputStream(fs).use { os -> os.writeObject(compiledScript) } } storedScripts++ } override var storedScripts: Int = 0 private set<|endoftext|>