Value classes: treat @JvmInline value classes as inline classes

Report error on value classes without @JvmInline annotation.
Do not check for @JvmInline annotation in value classes since
it breaks reflection.
This commit is contained in:
Ilmir Usmanov
2020-11-19 02:20:37 +01:00
parent 6c68660ffd
commit 92f1681de0
100 changed files with 2668 additions and 53 deletions
@@ -267,7 +267,7 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
if (classDescriptor.kind != ClassKind.CLASS) return false
if (classOrObject.isLocal) return false
if (classDescriptor.isInline) return false
if (classDescriptor.isInlineClass()) return false
if (shouldHideConstructorDueToInlineClassTypeValueParameters(constructorDescriptor)) return false
if (CodegenBinding.canHaveOuter(state.bindingContext, classDescriptor)) return false
@@ -216,7 +216,7 @@ public class DescriptorAsmUtil {
private static boolean isInlineClassWrapperConstructor(@NotNull FunctionDescriptor functionDescriptor, @Nullable OwnerKind kind) {
if (!(functionDescriptor instanceof ConstructorDescriptor)) return false;
ClassDescriptor classDescriptor = ((ConstructorDescriptor) functionDescriptor).getConstructedClass();
return classDescriptor.isInline() && kind == OwnerKind.IMPLEMENTATION;
return InlineClassesUtilsKt.isInlineClass(classDescriptor) && kind == OwnerKind.IMPLEMENTATION;
}
public static int getCommonCallableFlags(FunctionDescriptor functionDescriptor, @NotNull GenerationState state) {
@@ -559,7 +559,7 @@ public class DescriptorAsmUtil {
if (receiverKotlinType.isMarkedNullable()) return null;
DeclarationDescriptor receiverTypeDescriptor = receiverKotlinType.getConstructor().getDeclarationDescriptor();
assert receiverTypeDescriptor instanceof ClassDescriptor && ((ClassDescriptor) receiverTypeDescriptor).isInline() :
assert receiverTypeDescriptor != null && InlineClassesUtilsKt.isInlineClass(receiverTypeDescriptor) :
"Inline class type expected: " + receiverKotlinType;
ClassDescriptor receiverClassDescriptor = (ClassDescriptor) receiverTypeDescriptor;
FunctionDescriptor toStringDescriptor = receiverClassDescriptor.getUnsubstitutedMemberScope()
@@ -1190,7 +1190,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
ClassDescriptor captureThis = closure.getCapturedOuterClassDescriptor();
if (captureThis != null) {
StackValue thisOrOuter = generateThisOrOuter(captureThis, false);
assert !isPrimitive(thisOrOuter.type) || captureThis.isInline() :
assert !isPrimitive(thisOrOuter.type) || InlineClassesUtilsKt.isInlineClass(captureThis) :
"This or outer for " + captureThis + " should be non-primitive: " + thisOrOuter.type;
callGenerator.putCapturedValueOnStack(thisOrOuter, thisOrOuter.type, paramIndex++);
}
@@ -4830,7 +4830,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
ReceiverParameterDescriptor dispatchReceiver = constructor.getDispatchReceiverParameter();
ClassDescriptor containingDeclaration = constructor.getContainingDeclaration();
if (!containingDeclaration.isInline()) {
if (!InlineClassesUtilsKt.isInlineClass(containingDeclaration)) {
v.anew(objectType);
v.dup();
}
@@ -1589,7 +1589,7 @@ public class FunctionCodegen {
// When delegating to inline class, we invoke static implementation method
// that takes inline class underlying value as 1st argument.
int toArgsShift = toClass.isInline() ? 1 : 0;
int toArgsShift = InlineClassesUtilsKt.isInlineClass(toClass) ? 1 : 0;
int reg = 1;
for (int i = 0; i < argTypes.length; ++i) {
@@ -1609,7 +1609,7 @@ public class FunctionCodegen {
if (toClass.getKind() == ClassKind.INTERFACE) {
iv.invokeinterface(internalName, delegateToMethod.getName(), delegateToMethod.getDescriptor());
}
else if (toClass.isInline()) {
else if (InlineClassesUtilsKt.isInlineClass(toClass)) {
iv.invokestatic(internalName, delegateToMethod.getName(), delegateToMethod.getDescriptor(), false);
}
else {
@@ -84,7 +84,7 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator {
String toStringMethodDesc = getToStringDesc();
MethodVisitor mv = v.newMethod(methodOrigin, getAccess(), toStringMethodName, toStringMethodDesc, null, null);
if (!isInErasedInlineClass && classDescriptor.isInline()) {
if (!isInErasedInlineClass && InlineClassesUtilsKt.isInlineClass(classDescriptor)) {
FunctionCodegen.generateMethodInsideInlineClassWrapper(methodOrigin, function, classDescriptor, mv, typeMapper);
return;
}
@@ -161,7 +161,7 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator {
String hashCodeMethodDesc = getHashCodeDesc();
MethodVisitor mv = v.newMethod(methodOrigin, getAccess(), hashCodeMethodName, hashCodeMethodDesc, null, null);
if (!isInErasedInlineClass && classDescriptor.isInline()) {
if (!isInErasedInlineClass && InlineClassesUtilsKt.isInlineClass(classDescriptor)) {
FunctionCodegen.generateMethodInsideInlineClassWrapper(methodOrigin, function, classDescriptor, mv, typeMapper);
return;
}
@@ -233,7 +233,7 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator {
String equalsMethodDesc = getEqualsDesc();
MethodVisitor mv = v.newMethod(methodOrigin, getAccess(), equalsMethodName, equalsMethodDesc, null, null);
if (!isInErasedInlineClass && classDescriptor.isInline()) {
if (!isInErasedInlineClass && InlineClassesUtilsKt.isInlineClass(classDescriptor)) {
FunctionCodegen.generateMethodInsideInlineClassWrapper(methodOrigin, function, classDescriptor, mv, typeMapper);
return;
}
@@ -260,7 +260,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
@Override
protected void generateErasedInlineClassIfNeeded() {
if (!(myClass instanceof KtClass)) return;
if (!descriptor.isInline()) return;
if (!InlineClassesUtilsKt.isInlineClass(descriptor)) return;
ClassContext erasedInlineClassContext = context.intoWrapperForErasedInlineClass(descriptor, state);
new ErasedInlineClassBodyCodegen((KtClass) myClass, erasedInlineClassContext, v, state, this).generate();
@@ -269,7 +269,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
@Override
protected void generateUnboxMethodForInlineClass() {
if (!(myClass instanceof KtClass)) return;
if (!descriptor.isInline()) return;
if (!InlineClassesUtilsKt.isInlineClass(descriptor)) return;
Type ownerType = typeMapper.mapClass(descriptor);
ValueParameterDescriptor inlinedValue = InlineClassesUtilsKt.underlyingRepresentation(this.descriptor);
@@ -450,7 +450,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
try {
lookupConstructorExpressionsInClosureIfPresent();
constructorCodegen.generatePrimaryConstructor(delegationFieldsInfo, superClassAsmType);
if (!descriptor.isInline() && !(descriptor instanceof SyntheticClassOrObjectDescriptor)) {
if (!InlineClassesUtilsKt.isInlineClass(descriptor) && !(descriptor instanceof SyntheticClassOrObjectDescriptor)) {
// Synthetic classes does not have declarations for secondary constructors
for (ClassConstructorDescriptor secondaryConstructor : DescriptorUtilsKt.getSecondaryConstructors(descriptor)) {
constructorCodegen.generateSecondaryConstructor(secondaryConstructor, superClassAsmType);
@@ -552,7 +552,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
private void generateFunctionsFromAnyForInlineClasses() {
if (!descriptor.isInline()) return;
if (!InlineClassesUtilsKt.isInlineClass(descriptor)) return;
if (!(myClass instanceof KtClassOrObject)) return;
new FunctionsFromAnyGeneratorImpl(
(KtClassOrObject) myClass, bindingContext, descriptor, classAsmType, context, v, state
@@ -775,7 +775,8 @@ public abstract class StackValue {
) {
// Coerce 'this' for the case when it is smart cast.
// Do not coerce for other cases due to the 'protected' access issues (JVMS 7, 4.9.2 Structural Constraints).
boolean coerceType = descriptor.getKind() == ClassKind.INTERFACE || descriptor.isInline() || (castReceiver && !isSuper);
boolean coerceType = descriptor.getKind() == ClassKind.INTERFACE || InlineClassesUtilsKt.isInlineClass(descriptor) ||
(castReceiver && !isSuper);
return new ThisOuter(codegen, descriptor, isSuper, coerceType);
}
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.codegen.binding.MutableClosure;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor;
import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt;
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
import org.jetbrains.kotlin.types.SimpleType;
import org.jetbrains.org.objectweb.asm.Type;
@@ -48,7 +49,7 @@ public class ConstructorContext extends MethodContext {
ClassDescriptor capturedOuterClassDescriptor = closure != null ? closure.getCapturedOuterClassDescriptor() : null;
StackValue stackValue;
if (capturedOuterClassDescriptor != null) {
if (capturedOuterClassDescriptor.isInline()) {
if (InlineClassesUtilsKt.isInlineClass(capturedOuterClassDescriptor)) {
SimpleType outerClassKotlinType = capturedOuterClassDescriptor.getDefaultType();
Type outerClassType = kotlinTypeMapper.mapType(capturedOuterClassDescriptor);
stackValue = StackValue.local(1, outerClassType, outerClassKotlinType);
@@ -20,6 +20,7 @@ import com.intellij.openapi.util.Pair
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.codegen.optimization.common.StrictBasicValue
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode
@@ -119,7 +120,7 @@ fun getUnboxedType(boxedType: Type, state: GenerationState): Type {
fun unboxedTypeOfInlineClass(boxedType: Type, state: GenerationState): Type? {
val descriptor =
state.jvmBackendClassResolver.resolveToClassDescriptors(boxedType).singleOrNull()?.takeIf { it.isInline } ?: return null
state.jvmBackendClassResolver.resolveToClassDescriptors(boxedType).singleOrNull()?.takeIf { it.isInlineClass() } ?: return null
return state.mapInlineClass(descriptor)
}
@@ -445,7 +445,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
}
}
} else {
val toInlinedErasedClass = functionParent.isInline &&
val toInlinedErasedClass = functionParent.isInlineClass() &&
(!isAccessor(functionDescriptor) || isInlineClassConstructorAccessor(functionDescriptor))
if (toInlinedErasedClass) {
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForParameterTypes
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForReturnType
import org.jetbrains.kotlin.types.KotlinType
@@ -111,7 +112,7 @@ fun getManglingSuffixBasedOnKotlinSignature(
private fun getInfoForMangling(type: KotlinType): InfoForMangling? {
val descriptor = type.constructor.declarationDescriptor ?: return null
return when (descriptor) {
is ClassDescriptor -> InfoForMangling(descriptor.fqNameUnsafe, descriptor.isInline, type.isMarkedNullable)
is ClassDescriptor -> InfoForMangling(descriptor.fqNameUnsafe, descriptor.isInlineClass(), type.isMarkedNullable)
is TypeParameterDescriptor -> {
getInfoForMangling(descriptor.representativeUpperBound)
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.asTypeProjection
@@ -93,4 +94,4 @@ fun KotlinType.removeExternalProjections(): KotlinType {
fun isInlineClassConstructorAccessor(descriptor: FunctionDescriptor): Boolean =
descriptor is AccessorForConstructorDescriptor &&
descriptor.calleeDescriptor.constructedClass.isInline
descriptor.calleeDescriptor.constructedClass.isInlineClass()
@@ -24968,6 +24968,129 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
}
}
@TestMetadata("compiler/testData/diagnostics/tests/valueClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ValueClasses extends AbstractFirOldFrontendDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInValueClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/valueClasses"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("basicValueClassDeclaration.kt")
public void testBasicValueClassDeclaration() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt");
}
@TestMetadata("basicValueClassDeclarationDisabled.kt")
public void testBasicValueClassDeclarationDisabled() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt");
}
@TestMetadata("constructorsJvmSignaturesClash.kt")
public void testConstructorsJvmSignaturesClash() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt");
}
@TestMetadata("delegatedPropertyInValueClass.kt")
public void testDelegatedPropertyInValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt");
}
@TestMetadata("functionsJvmSignaturesClash.kt")
public void testFunctionsJvmSignaturesClash() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt");
}
@TestMetadata("functionsJvmSignaturesConflictOnInheritance.kt")
public void testFunctionsJvmSignaturesConflictOnInheritance() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt");
}
@TestMetadata("identityComparisonWithValueClasses.kt")
public void testIdentityComparisonWithValueClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt");
}
@TestMetadata("lateinitValueClasses.kt")
public void testLateinitValueClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt");
}
@TestMetadata("presenceOfInitializerBlockInsideValueClass.kt")
public void testPresenceOfInitializerBlockInsideValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt");
}
@TestMetadata("presenceOfPublicPrimaryConstructorForValueClass.kt")
public void testPresenceOfPublicPrimaryConstructorForValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt");
}
@TestMetadata("propertiesWithBackingFieldsInsideValueClass.kt")
public void testPropertiesWithBackingFieldsInsideValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt");
}
@TestMetadata("recursiveValueClasses.kt")
public void testRecursiveValueClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt");
}
@TestMetadata("reservedMembersAndConstructsInsideValueClass.kt")
public void testReservedMembersAndConstructsInsideValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt");
}
@TestMetadata("unsignedLiteralsWithoutArtifactOnClasspath.kt")
public void testUnsignedLiteralsWithoutArtifactOnClasspath() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt");
}
@TestMetadata("valueClassCanOnlyImplementInterfaces.kt")
public void testValueClassCanOnlyImplementInterfaces() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt");
}
@TestMetadata("valueClassCannotImplementInterfaceByDelegation.kt")
public void testValueClassCannotImplementInterfaceByDelegation() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt");
}
@TestMetadata("valueClassConstructorParameterWithDefaultValue.kt")
public void testValueClassConstructorParameterWithDefaultValue() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt");
}
@TestMetadata("valueClassDeclarationCheck.kt")
public void testValueClassDeclarationCheck() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt");
}
@TestMetadata("valueClassImplementsCollection.kt")
public void testValueClassImplementsCollection() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt");
}
@TestMetadata("valueClassWithForbiddenUnderlyingType.kt")
public void testValueClassWithForbiddenUnderlyingType() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt");
}
@TestMetadata("valueClassesInsideAnnotations.kt")
public void testValueClassesInsideAnnotations() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt");
}
@TestMetadata("varargsOnParametersOfValueClassType.kt")
public void testVarargsOnParametersOfValueClassType() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/tests/varargs")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -362,6 +362,7 @@ public interface Errors {
DiagnosticFactory0<KtTypeReference> INLINE_CLASS_CANNOT_BE_RECURSIVE = DiagnosticFactory0.create(ERROR);
DiagnosticFactory1<PsiElement, String> RESERVED_MEMBER_INSIDE_INLINE_CLASS = DiagnosticFactory1.create(ERROR);
DiagnosticFactory0<PsiElement> SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement> VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION = DiagnosticFactory0.create(ERROR);
// Result class
@@ -717,6 +717,7 @@ public class DefaultErrorMessages {
MAP.put(INLINE_CLASS_CANNOT_BE_RECURSIVE, "Inline class cannot be recursive");
MAP.put(RESERVED_MEMBER_INSIDE_INLINE_CLASS, "Member with the name ''{0}'' is reserved for future releases", STRING);
MAP.put(SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS, "Secondary constructors with bodies are reserved for for future releases");
MAP.put(VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION, "Value classes without @JvmInline annotation are not supported yet");
MAP.put(RESULT_CLASS_IN_RETURN_TYPE, "'kotlin.Result' cannot be used as a return type");
MAP.put(RESULT_CLASS_WITH_NULLABLE_OPERATOR, "Expression of type 'kotlin.Result' cannot be used as a left operand of ''{0}''", STRING);
@@ -270,7 +270,7 @@ class DeclarationsChecker(
if (declaration is KtPrimaryConstructor &&
!DescriptorUtils.isAnnotationClass(constructorDescriptor.constructedClass) &&
!constructorDescriptor.constructedClass.isInline
!constructorDescriptor.constructedClass.isInlineClass()
) {
for (parameter in declaration.valueParameters) {
if (parameter.hasValOrVar()) {
@@ -107,7 +107,8 @@ object ModifierCheckerCore {
ANNOTATION_CLASS,
TYPEALIAS
),
FUN_KEYWORD to EnumSet.of(INTERFACE)
FUN_KEYWORD to EnumSet.of(INTERFACE),
VALUE_KEYWORD to EnumSet.of(CLASS_ONLY)
)
private val featureDependencies = mapOf(
@@ -118,7 +119,8 @@ object ModifierCheckerCore {
EXPECT_KEYWORD to listOf(LanguageFeature.MultiPlatformProjects),
ACTUAL_KEYWORD to listOf(LanguageFeature.MultiPlatformProjects),
LATEINIT_KEYWORD to listOf(LanguageFeature.LateinitTopLevelProperties, LanguageFeature.LateinitLocalVariables),
FUN_KEYWORD to listOf(LanguageFeature.FunctionalInterfaceConversion)
FUN_KEYWORD to listOf(LanguageFeature.FunctionalInterfaceConversion),
VALUE_KEYWORD to listOf(LanguageFeature.InlineClasses)
)
private val featureDependenciesTargets = mapOf(
@@ -185,12 +187,13 @@ object ModifierCheckerCore {
result += incompatibilityRegister(PRIVATE_KEYWORD, PROTECTED_KEYWORD, PUBLIC_KEYWORD, INTERNAL_KEYWORD)
// Abstract + open + final + sealed: incompatible
result += incompatibilityRegister(ABSTRACT_KEYWORD, OPEN_KEYWORD, FINAL_KEYWORD, SEALED_KEYWORD)
// data + open, data + inner, data + abstract, data + sealed, data + inline
// data + open, data + inner, data + abstract, data + sealed, data + inline, data + value
result += incompatibilityRegister(DATA_KEYWORD, OPEN_KEYWORD)
result += incompatibilityRegister(DATA_KEYWORD, INNER_KEYWORD)
result += incompatibilityRegister(DATA_KEYWORD, ABSTRACT_KEYWORD)
result += incompatibilityRegister(DATA_KEYWORD, SEALED_KEYWORD)
result += incompatibilityRegister(DATA_KEYWORD, INLINE_KEYWORD)
result += incompatibilityRegister(DATA_KEYWORD, VALUE_KEYWORD)
// open is redundant to abstract & override
result += redundantRegister(ABSTRACT_KEYWORD, OPEN_KEYWORD)
// abstract is redundant to sealed
@@ -9,9 +9,9 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.modalityModifier
import org.jetbrains.kotlin.psi.psiUtil.visibilityModifier
import org.jetbrains.kotlin.resolve.*
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.isNothing
@@ -22,15 +22,16 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs
object InlineClassDeclarationChecker : DeclarationChecker {
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
if (declaration !is KtClass) return
if (descriptor !is ClassDescriptor || !descriptor.isInline) return
if (descriptor !is ClassDescriptor || !descriptor.isInline && !descriptor.isValue) return
if (descriptor.kind != ClassKind.CLASS) return
val inlineKeyword = declaration.modifierList?.getModifier(KtTokens.INLINE_KEYWORD)
require(inlineKeyword != null) { "Declaration of inline class must have 'inline' keyword" }
val inlineOrValueKeyword = declaration.modifierList?.getModifier(KtTokens.INLINE_KEYWORD)
?: declaration.modifierList?.getModifier(KtTokens.VALUE_KEYWORD)
require(inlineOrValueKeyword != null) { "Declaration of inline class must have 'inline' keyword" }
val trace = context.trace
if (!DescriptorUtils.isTopLevelDeclaration(descriptor)) {
trace.report(Errors.INLINE_CLASS_NOT_TOP_LEVEL.on(inlineKeyword))
trace.report(Errors.INLINE_CLASS_NOT_TOP_LEVEL.on(inlineOrValueKeyword))
return
}
@@ -42,7 +43,7 @@ object InlineClassDeclarationChecker : DeclarationChecker {
val primaryConstructor = declaration.primaryConstructor
if (primaryConstructor == null) {
trace.report(Errors.ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS.on(inlineKeyword))
trace.report(Errors.ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS.on(inlineOrValueKeyword))
return
}
@@ -87,6 +88,10 @@ object InlineClassDeclarationChecker : DeclarationChecker {
}
}
}
if (descriptor.isValue && !descriptor.annotations.hasAnnotation(JVM_INLINE_ANNOTATION)) {
trace.report(Errors.VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION.on(inlineOrValueKeyword))
}
}
private fun KotlinType.isInapplicableParameterType() =
@@ -258,7 +258,7 @@ open class LazyClassMemberScope(
name: Name,
fromSupertypes: List<SimpleFunctionDescriptor>
) {
if (!thisDescriptor.isInline) return
if (!thisDescriptor.isInlineClass()) return
addFunctionFromAnyIfNeeded(result, name, fromSupertypes)
}
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.resolve.scopes.getDescriptorsFiltered
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DescriptorWithContainerSource
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
@@ -274,7 +275,7 @@ class DeclarationStubGenerator(
isInner = descriptor.isInner,
isData = descriptor.isData,
isExternal = descriptor.isEffectivelyExternal(),
isInline = descriptor.isInline,
isInline = descriptor.isInlineClass(),
isExpect = descriptor.isExpect,
isFun = descriptor.isFun,
stubGenerator = this,
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.ir.declarations.IrFactory
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.types.KotlinType
val ParameterDescriptor.indexOrMinusOne: Int
@@ -38,5 +39,5 @@ fun IrFactory.createIrClassFromDescriptor(
): IrClass = createClass(
startOffset, endOffset, origin, symbol, name, descriptor.kind, visibility, modality,
descriptor.isCompanionObject, descriptor.isInner, descriptor.isData, descriptor.isEffectivelyExternal(),
descriptor.isInline, descriptor.isExpect, descriptor.isFun, descriptor.source
descriptor.isInlineClass(), descriptor.isExpect, descriptor.isFun, descriptor.source
)
@@ -33,6 +33,7 @@ open class KtClass : KtClassOrObject {
fun isSealed(): Boolean = hasModifier(KtTokens.SEALED_KEYWORD)
fun isInner(): Boolean = hasModifier(KtTokens.INNER_KEYWORD)
fun isInline(): Boolean = hasModifier(KtTokens.INLINE_KEYWORD)
fun isValue(): Boolean = hasModifier(KtTokens.VALUE_KEYWORD)
override fun getCompanionObjects(): List<KtObjectDeclaration> = body?.allCompanionObjects.orEmpty()
@@ -23,10 +23,8 @@ import org.jetbrains.kotlin.metadata.serialization.MutableTypeTable
import org.jetbrains.kotlin.metadata.serialization.MutableVersionRequirementTable
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.*
import org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumEntry
import org.jetbrains.kotlin.resolve.MemberComparator
import org.jetbrains.kotlin.resolve.RequireKotlinConstants
import org.jetbrains.kotlin.resolve.calls.components.isActualParameterWithAnyExpectedDefault
import org.jetbrains.kotlin.resolve.constants.EnumValue
import org.jetbrains.kotlin.resolve.constants.IntValue
@@ -34,7 +32,6 @@ import org.jetbrains.kotlin.resolve.constants.NullValue
import org.jetbrains.kotlin.resolve.constants.StringValue
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.descriptorUtil.nonSourceAnnotations
import org.jetbrains.kotlin.resolve.isInlineClassType
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
import org.jetbrains.kotlin.serialization.deserialization.descriptorVisibility
import org.jetbrains.kotlin.serialization.deserialization.memberKind
@@ -74,7 +71,7 @@ class DescriptorSerializer private constructor(
ProtoEnumFlags.modality(classDescriptor.modality),
ProtoEnumFlags.classKind(classDescriptor.kind, classDescriptor.isCompanionObject),
classDescriptor.isInner, classDescriptor.isData, classDescriptor.isExternal, classDescriptor.isExpect,
classDescriptor.isInline, classDescriptor.isFun
classDescriptor.isInlineClass(), classDescriptor.isFun
)
if (flags != builder.flags) {
builder.flags = flags
@@ -173,7 +170,7 @@ class DescriptorSerializer private constructor(
builder: ProtoBuf.Class.Builder,
versionRequirementTable: MutableVersionRequirementTable
) {
if (!classDescriptor.isInline && !classDescriptor.hasInlineClassTypesInSignature()) return
if (!classDescriptor.isInlineClass() && !classDescriptor.hasInlineClassTypesInSignature()) return
builder.addVersionRequirement(
writeLanguageVersionRequirement(LanguageFeature.InlineClasses, versionRequirementTable)
@@ -0,0 +1,13 @@
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
@JvmInline
value class Foo(val x: Int)
value interface InlineInterface
value annotation class InlineAnn
value object InlineObject
value enum class InlineEnum
@@ -0,0 +1,13 @@
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
@JvmInline
value class Foo(val x: Int)
<!WRONG_MODIFIER_TARGET!>value<!> interface InlineInterface
<!WRONG_MODIFIER_TARGET!>value<!> annotation class InlineAnn
<!WRONG_MODIFIER_TARGET!>value<!> object InlineObject
<!WRONG_MODIFIER_TARGET!>value<!> enum class InlineEnum
@@ -0,0 +1,56 @@
package
package kotlin {
@kotlin.JvmInline public final value class Foo {
public constructor Foo(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final value annotation class InlineAnn : kotlin.Annotation {
public constructor InlineAnn()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final value enum class InlineEnum : kotlin.Enum<kotlin.InlineEnum> {
private constructor InlineEnum()
public final override /*1*/ /*fake_override*/ val name: kotlin.String
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: kotlin.InlineEnum): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<kotlin.InlineEnum!>!
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): kotlin.InlineEnum
public final /*synthesized*/ fun values(): kotlin.Array<kotlin.InlineEnum>
}
public value interface InlineInterface {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public value object InlineObject {
private constructor InlineObject()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,15 @@
// !LANGUAGE: -InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin
annotation class JvmInline
value class Foo(val x: Int)
value annotation class InlineAnn
value object InlineObject
value enum class InlineEnum
@JvmInline
value class NotVal(x: Int)
@@ -0,0 +1,15 @@
// !LANGUAGE: -InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin
annotation class JvmInline
<!UNSUPPORTED_FEATURE, VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION!>value<!> class Foo(val x: Int)
<!WRONG_MODIFIER_TARGET!>value<!> annotation class InlineAnn
<!WRONG_MODIFIER_TARGET!>value<!> object InlineObject
<!WRONG_MODIFIER_TARGET!>value<!> enum class InlineEnum
@JvmInline
<!UNSUPPORTED_FEATURE!>value<!> class NotVal(<!INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER!>x: Int<!>)
@@ -0,0 +1,57 @@
package
package kotlin {
public final value class Foo {
public constructor Foo(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final value annotation class InlineAnn : kotlin.Annotation {
public constructor InlineAnn()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final value enum class InlineEnum : kotlin.Enum<kotlin.InlineEnum> {
private constructor InlineEnum()
public final override /*1*/ /*fake_override*/ val name: kotlin.String
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: kotlin.InlineEnum): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<kotlin.InlineEnum!>!
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): kotlin.InlineEnum
public final /*synthesized*/ fun values(): kotlin.Array<kotlin.InlineEnum>
}
public value object InlineObject {
private constructor InlineObject()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class NotVal {
public constructor NotVal(/*0*/ x: kotlin.Int)
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,24 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin
annotation class JvmInline
@JvmInline
value class X(val x: Int)
@JvmInline
value class Z(val x: Int)
class TestOk1(val a: Int, val b: Int) {
constructor(x: X) : this(x.x, 1)
}
class TestErr1(val a: Int) {
constructor(x: X) : this(x.x)
}
class TestErr2(val a: Int, val b: Int) {
constructor(x: X) : this(x.x, 1)
constructor(z: Z) : this(z.x, 2)
}
@@ -0,0 +1,24 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin
annotation class JvmInline
@JvmInline
value class X(val x: Int)
@JvmInline
value class Z(val x: Int)
class TestOk1(val a: Int, val b: Int) {
constructor(x: X) : this(x.x, 1)
}
class TestErr1(val a: Int) {
<!CONFLICTING_JVM_DECLARATIONS!>constructor(x: X)<!> : this(x.x)
}
class <!CONFLICTING_JVM_DECLARATIONS!>TestErr2(val a: Int, val b: Int)<!> {
<!CONFLICTING_JVM_DECLARATIONS!>constructor(x: X)<!> : this(x.x, 1)
<!CONFLICTING_JVM_DECLARATIONS!>constructor(z: Z)<!> : this(z.x, 2)
}
@@ -0,0 +1,57 @@
package
package kotlin {
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class TestErr1 {
public constructor TestErr1(/*0*/ a: kotlin.Int)
public constructor TestErr1(/*0*/ x: kotlin.X)
public final val a: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class TestErr2 {
public constructor TestErr2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int)
public constructor TestErr2(/*0*/ x: kotlin.X)
public constructor TestErr2(/*0*/ z: kotlin.Z)
public final val a: kotlin.Int
public final val b: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class TestOk1 {
public constructor TestOk1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int)
public constructor TestOk1(/*0*/ x: kotlin.X)
public final val a: kotlin.Int
public final val b: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class X {
public constructor X(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Z {
public constructor Z(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,33 @@
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
class Val {
operator fun getValue(thisRef: Any?, kProp: Any?) = 1
}
class Var {
operator fun getValue(thisRef: Any?, kProp: Any?) = 2
operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {}
}
object ValObject {
operator fun getValue(thisRef: Any?, kProp: Any?) = 1
}
object VarObject {
operator fun getValue(thisRef: Any?, kProp: Any?) = 2
operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {}
}
@JvmInline
value class Z(val data: Int) {
val testVal by Val()
var testVar by Var()
val testValBySingleton by ValObject
var testVarBySingleton by VarObject
}
@@ -0,0 +1,33 @@
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
class Val {
operator fun getValue(thisRef: Any?, kProp: Any?) = 1
}
class Var {
operator fun getValue(thisRef: Any?, kProp: Any?) = 2
operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {}
}
object ValObject {
operator fun getValue(thisRef: Any?, kProp: Any?) = 1
}
object VarObject {
operator fun getValue(thisRef: Any?, kProp: Any?) = 2
operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {}
}
@JvmInline
value class Z(val data: Int) {
val testVal <!DELEGATED_PROPERTY_INSIDE_INLINE_CLASS!>by Val()<!>
var testVar <!DELEGATED_PROPERTY_INSIDE_INLINE_CLASS!>by Var()<!>
val testValBySingleton <!DELEGATED_PROPERTY_INSIDE_INLINE_CLASS!>by ValObject<!>
var testVarBySingleton <!DELEGATED_PROPERTY_INSIDE_INLINE_CLASS!>by VarObject<!>
}
@@ -0,0 +1,57 @@
package
package kotlin {
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Val {
public constructor Val()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public object ValObject {
private constructor ValObject()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Var {
public constructor Var()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?, /*2*/ value: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public object VarObject {
private constructor VarObject()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kProp: kotlin.Any?, /*2*/ value: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Z {
public constructor Z(/*0*/ data: kotlin.Int)
public final val data: kotlin.Int
public final val testVal: kotlin.Int
public final val testValBySingleton: kotlin.Int
public final var testVar: kotlin.Int
public final var testVarBySingleton: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,46 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin
annotation class JvmInline
@JvmInline
value class X(val x: Int)
@JvmInline
value class Z(val x: Int)
@JvmInline
value class Str(val str: String)
@JvmInline
value class Name(val name: String)
@JvmInline
value class NStr(val str: String?)
fun testSimple(x: X) {}
fun testSimple(z: Z) {}
fun testMixed(x: Int, y: Int) {}
fun testMixed(x: X, y: Int) {}
fun testMixed(x: Int, y: X) {}
fun testMixed(x: X, y: X) {}
fun testNewType(s: Str) {}
fun testNewType(name: Name) {}
fun testNullableVsNonNull1(s: Str) {}
fun testNullableVsNonNull1(s: Str?) {}
fun testNullableVsNonNull2(ns: NStr) {}
fun testNullableVsNonNull2(ns: NStr?) {}
fun testFunVsExt(x: X) {}
fun X.testFunVsExt() {}
fun testNonGenericVsGeneric(x: X, y: Number) {}
fun <T : Number> testNonGenericVsGeneric(x: X, y: T) {}
class C<TC : Number> {
fun testNonGenericVsGeneric(x: X, y: Number) {}
fun <T : Number> testNonGenericVsGeneric(x: X, y: T) {}
fun testNonGenericVsGeneric(x: X, y: TC) {}
}
@@ -0,0 +1,46 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin
annotation class JvmInline
@JvmInline
value class X(val x: Int)
@JvmInline
value class Z(val x: Int)
@JvmInline
value class Str(val str: String)
@JvmInline
value class Name(val name: String)
@JvmInline
value class NStr(val str: String?)
fun testSimple(x: X) {}
fun testSimple(z: Z) {}
fun testMixed(x: Int, y: Int) {}
fun testMixed(x: X, y: Int) {}
fun testMixed(x: Int, y: X) {}
fun testMixed(x: X, y: X) {}
fun testNewType(s: Str) {}
fun testNewType(name: Name) {}
fun testNullableVsNonNull1(s: Str) {}
fun testNullableVsNonNull1(s: Str?) {}
fun testNullableVsNonNull2(ns: NStr) {}
fun testNullableVsNonNull2(ns: NStr?) {}
<!CONFLICTING_JVM_DECLARATIONS!>fun testFunVsExt(x: X)<!> {}
<!CONFLICTING_JVM_DECLARATIONS!>fun X.testFunVsExt()<!> {}
<!CONFLICTING_JVM_DECLARATIONS!>fun testNonGenericVsGeneric(x: X, y: Number)<!> {}
<!CONFLICTING_JVM_DECLARATIONS!>fun <T : Number> testNonGenericVsGeneric(x: X, y: T)<!> {}
class C<TC : Number> {
<!CONFLICTING_JVM_DECLARATIONS!>fun testNonGenericVsGeneric(x: X, y: Number)<!> {}
<!CONFLICTING_JVM_DECLARATIONS!>fun <T : Number> testNonGenericVsGeneric(x: X, y: T)<!> {}
<!CONFLICTING_JVM_DECLARATIONS!>fun testNonGenericVsGeneric(x: X, y: TC)<!> {}
}
@@ -0,0 +1,77 @@
package
package kotlin {
public fun testFunVsExt(/*0*/ x: kotlin.X): kotlin.Unit
public fun testMixed(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Unit
public fun testMixed(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.X): kotlin.Unit
public fun testMixed(/*0*/ x: kotlin.X, /*1*/ y: kotlin.Int): kotlin.Unit
public fun testMixed(/*0*/ x: kotlin.X, /*1*/ y: kotlin.X): kotlin.Unit
public fun testNewType(/*0*/ name: kotlin.Name): kotlin.Unit
public fun testNewType(/*0*/ s: kotlin.Str): kotlin.Unit
public fun </*0*/ T : kotlin.Number> testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: T): kotlin.Unit
public fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: kotlin.Number): kotlin.Unit
public fun testNullableVsNonNull1(/*0*/ s: kotlin.Str): kotlin.Unit
public fun testNullableVsNonNull1(/*0*/ s: kotlin.Str?): kotlin.Unit
public fun testNullableVsNonNull2(/*0*/ ns: kotlin.NStr): kotlin.Unit
public fun testNullableVsNonNull2(/*0*/ ns: kotlin.NStr?): kotlin.Unit
public fun testSimple(/*0*/ x: kotlin.X): kotlin.Unit
public fun testSimple(/*0*/ z: kotlin.Z): kotlin.Unit
public fun kotlin.X.testFunVsExt(): kotlin.Unit
public final class C</*0*/ TC : kotlin.Number> {
public constructor C</*0*/ TC : kotlin.Number>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun </*0*/ T : kotlin.Number> testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: T): kotlin.Unit
public final fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: TC): kotlin.Unit
public final fun testNonGenericVsGeneric(/*0*/ x: kotlin.X, /*1*/ y: kotlin.Number): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class NStr {
public constructor NStr(/*0*/ str: kotlin.String?)
public final val str: kotlin.String?
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Name {
public constructor Name(/*0*/ name: kotlin.String)
public final val name: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Str {
public constructor Str(/*0*/ str: kotlin.String)
public final val str: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class X {
public constructor X(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Z {
public constructor Z(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,21 @@
// FIR_IDENTICAL
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
@JvmInline
value class Name(val name: String)
@JvmInline
value class Password(val password: String)
interface NameVerifier {
fun verify(name: Name)
}
interface PasswordVerifier {
fun verify(password: Password)
}
interface NameAndPasswordVerifier : NameVerifier, PasswordVerifier
@@ -0,0 +1,49 @@
package
package kotlin {
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Name {
public constructor Name(/*0*/ name: kotlin.String)
public final val name: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public interface NameAndPasswordVerifier : kotlin.NameVerifier, kotlin.PasswordVerifier {
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
public abstract override /*1*/ /*fake_override*/ fun verify(/*0*/ name: kotlin.Name): kotlin.Unit
public abstract override /*1*/ /*fake_override*/ fun verify(/*0*/ password: kotlin.Password): kotlin.Unit
}
public interface NameVerifier {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public abstract fun verify(/*0*/ name: kotlin.Name): kotlin.Unit
}
@kotlin.JvmInline public final value class Password {
public constructor Password(/*0*/ password: kotlin.String)
public final val password: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public interface PasswordVerifier {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public abstract fun verify(/*0*/ password: kotlin.Password): kotlin.Unit
}
}
@@ -0,0 +1,21 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_VARIABLE
package kotlin
annotation class JvmInline
@JvmInline
value class Foo(val x: Int)
@JvmInline
value class Bar(val y: String)
fun test(f1: Foo, f2: Foo, b1: Bar, fn1: Foo?, fn2: Foo?) {
val a1 = f1 === f2 || f1 !== f2
val a2 = f1 === f1
val a3 = f1 === b1 || f1 !== b1
val c1 = fn1 === fn2 || fn1 !== fn2
val c2 = f1 === fn1 || f1 !== fn1
val c3 = b1 === fn1 || b1 !== fn1
}
@@ -0,0 +1,21 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_VARIABLE
package kotlin
annotation class JvmInline
@JvmInline
value class Foo(val x: Int)
@JvmInline
value class Bar(val y: String)
fun test(f1: Foo, f2: Foo, b1: Bar, fn1: Foo?, fn2: Foo?) {
val a1 = <!FORBIDDEN_IDENTITY_EQUALS!>f1 === f2<!> || <!FORBIDDEN_IDENTITY_EQUALS!>f1 !== f2<!>
val a2 = <!FORBIDDEN_IDENTITY_EQUALS!>f1 === f1<!>
val a3 = <!EQUALITY_NOT_APPLICABLE!>f1 === b1<!> || <!EQUALITY_NOT_APPLICABLE!>f1 !== b1<!>
val c1 = <!FORBIDDEN_IDENTITY_EQUALS!>fn1 === fn2<!> || <!FORBIDDEN_IDENTITY_EQUALS!>fn1 !== fn2<!>
val c2 = f1 === fn1 || f1 !== fn1
val c3 = <!EQUALITY_NOT_APPLICABLE!>b1 === fn1<!> || <!EQUALITY_NOT_APPLICABLE!>b1 !== fn1<!>
}
@@ -0,0 +1,28 @@
package
package kotlin {
public fun test(/*0*/ f1: kotlin.Foo, /*1*/ f2: kotlin.Foo, /*2*/ b1: kotlin.Bar, /*3*/ fn1: kotlin.Foo?, /*4*/ fn2: kotlin.Foo?): kotlin.Unit
@kotlin.JvmInline public final value class Bar {
public constructor Bar(/*0*/ y: kotlin.String)
public final val y: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Foo {
public constructor Foo(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,15 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_VARIABLE
package kotlin
annotation class JvmInline
@JvmInline
value class Foo(val x: Int)
lateinit var a: Foo
fun foo() {
lateinit var b: Foo
}
@@ -0,0 +1,15 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_VARIABLE
package kotlin
annotation class JvmInline
@JvmInline
value class Foo(val x: Int)
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var a: Foo
fun foo() {
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var b: Foo
}
@@ -0,0 +1,21 @@
package
package kotlin {
public lateinit var a: kotlin.Foo
public fun foo(): kotlin.Unit
@kotlin.JvmInline public final value class Foo {
public constructor Foo(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,16 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_VARIABLE
// FIR_IDENTICAL
package kotlin
annotation class JvmInline
@JvmInline
value class Foo(val x: Int) {
init {}
init {
val f = 1
}
}
@@ -0,0 +1,19 @@
package
package kotlin {
@kotlin.JvmInline public final value class Foo {
public constructor Foo(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,17 @@
// !LANGUAGE: +InlineClasses
// FIR_IDENTICAL
package kotlin
annotation class JvmInline
@JvmInline
value class ConstructorWithDefaultVisibility(val x: Int)
@JvmInline
value class PublicConstructor public constructor(val x: Int)
@JvmInline
value class InternalConstructor internal constructor(val x: Int)
@JvmInline
value class ProtectedConstructor protected constructor(val x: Int)
@JvmInline
value class PrivateConstructor private constructor(val x: Int)
@@ -0,0 +1,51 @@
package
package kotlin {
@kotlin.JvmInline public final value class ConstructorWithDefaultVisibility {
public constructor ConstructorWithDefaultVisibility(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class InternalConstructor {
internal constructor InternalConstructor(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class PrivateConstructor {
private constructor PrivateConstructor(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class ProtectedConstructor {
protected constructor ProtectedConstructor(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class PublicConstructor {
public constructor PublicConstructor(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,39 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin
annotation class JvmInline
interface A {
val goodSize: Int
}
interface B {
val badSize: Int
}
@JvmInline
value class Foo(val x: Int) : A, B {
val a0
get() = 0
val a1 = 0
var a2: Int
get() = 1
set(value) {}
var a3: Int = 0
get() = 1
set(value) {
field = value
}
override val goodSize: Int
get() = 0
override val badSize: Int = 0
lateinit var lateinitProperty: String
}
@@ -0,0 +1,39 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin
annotation class JvmInline
interface A {
val goodSize: Int
}
interface B {
val badSize: Int
}
@JvmInline
value class Foo(val x: Int) : A, B {
val a0
get() = 0
<!PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS!>val a1<!> = 0
var a2: Int
get() = 1
set(value) {}
<!PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS!>var a3: Int<!> = 0
get() = 1
set(value) {
field = value
}
override val goodSize: Int
get() = 0
<!PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS!>override val badSize: Int<!> = 0
<!PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS!>lateinit var lateinitProperty: String<!>
}
@@ -0,0 +1,40 @@
package
package kotlin {
public interface A {
public abstract val goodSize: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface B {
public abstract val badSize: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Foo : kotlin.A, kotlin.B {
public constructor Foo(/*0*/ x: kotlin.Int)
public final val a0: kotlin.Int
public final val a1: kotlin.Int = 0
public final var a2: kotlin.Int
public final var a3: kotlin.Int
public open override /*1*/ val badSize: kotlin.Int = 0
public open override /*1*/ val goodSize: kotlin.Int
public final lateinit var lateinitProperty: kotlin.String
public final val x: kotlin.Int
public open override /*2*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*2*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*2*/ /*synthesized*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,37 @@
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
@JvmInline
value class Test1(val x: Test1)
@JvmInline
value class Test2A(val x: Test2B)
@JvmInline
value class Test2B(val x: Test2A)
@JvmInline
value class Test3A(val x: Test3B)
@JvmInline
value class Test3B(val x: Test3C)
@JvmInline
value class Test3C(val x: Test3A)
@JvmInline
value class TestNullable(val x: TestNullable?)
@JvmInline
value class TestRecursionInTypeArguments(val x: List<TestRecursionInTypeArguments>)
@JvmInline
value class TestRecursionInArray(val x: Array<TestRecursionInArray>)
@JvmInline
value class TestRecursionInUpperBounds<T : TestRecursionInUpperBounds<T>>(val x: T)
@JvmInline
value class Id<T>(val x: T)
@JvmInline
value class TestRecursionThroughId(val x: Id<TestRecursionThroughId>)
@@ -0,0 +1,37 @@
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
@JvmInline
value class Test1(val x: <!INLINE_CLASS_CANNOT_BE_RECURSIVE!>Test1<!>)
@JvmInline
value class Test2A(val x: <!INLINE_CLASS_CANNOT_BE_RECURSIVE!>Test2B<!>)
@JvmInline
value class Test2B(val x: <!INLINE_CLASS_CANNOT_BE_RECURSIVE!>Test2A<!>)
@JvmInline
value class Test3A(val x: <!INLINE_CLASS_CANNOT_BE_RECURSIVE!>Test3B<!>)
@JvmInline
value class Test3B(val x: <!INLINE_CLASS_CANNOT_BE_RECURSIVE!>Test3C<!>)
@JvmInline
value class Test3C(val x: <!INLINE_CLASS_CANNOT_BE_RECURSIVE!>Test3A<!>)
@JvmInline
value class TestNullable(val x: <!INLINE_CLASS_CANNOT_BE_RECURSIVE!>TestNullable?<!>)
@JvmInline
value class TestRecursionInTypeArguments(val x: List<TestRecursionInTypeArguments>)
@JvmInline
value class TestRecursionInArray(val x: Array<TestRecursionInArray>)
@JvmInline
value class TestRecursionInUpperBounds<T : TestRecursionInUpperBounds<T>>(val x: <!INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE!>T<!>)
@JvmInline
value class Id<T>(val x: <!INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE!>T<!>)
@JvmInline
value class TestRecursionThroughId(val x: Id<TestRecursionThroughId>)
@@ -0,0 +1,107 @@
package
package kotlin {
@kotlin.JvmInline public final value class Id</*0*/ T> {
public constructor Id</*0*/ T>(/*0*/ x: T)
public final val x: T
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Test1 {
public constructor Test1(/*0*/ x: kotlin.Test1)
public final val x: kotlin.Test1
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Test2A {
public constructor Test2A(/*0*/ x: kotlin.Test2B)
public final val x: kotlin.Test2B
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Test2B {
public constructor Test2B(/*0*/ x: kotlin.Test2A)
public final val x: kotlin.Test2A
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Test3A {
public constructor Test3A(/*0*/ x: kotlin.Test3B)
public final val x: kotlin.Test3B
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Test3B {
public constructor Test3B(/*0*/ x: kotlin.Test3C)
public final val x: kotlin.Test3C
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Test3C {
public constructor Test3C(/*0*/ x: kotlin.Test3A)
public final val x: kotlin.Test3A
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class TestNullable {
public constructor TestNullable(/*0*/ x: kotlin.TestNullable?)
public final val x: kotlin.TestNullable?
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class TestRecursionInArray {
public constructor TestRecursionInArray(/*0*/ x: kotlin.Array<kotlin.TestRecursionInArray>)
public final val x: kotlin.Array<kotlin.TestRecursionInArray>
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class TestRecursionInTypeArguments {
public constructor TestRecursionInTypeArguments(/*0*/ x: kotlin.collections.List<kotlin.TestRecursionInTypeArguments>)
public final val x: kotlin.collections.List<kotlin.TestRecursionInTypeArguments>
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class TestRecursionInUpperBounds</*0*/ T : kotlin.TestRecursionInUpperBounds<T>> {
public constructor TestRecursionInUpperBounds</*0*/ T : kotlin.TestRecursionInUpperBounds<T>>(/*0*/ x: T)
public final val x: T
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class TestRecursionThroughId {
public constructor TestRecursionThroughId(/*0*/ x: kotlin.Id<kotlin.TestRecursionThroughId>)
public final val x: kotlin.Id<kotlin.TestRecursionThroughId>
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,54 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin
annotation class JvmInline
@JvmInline
value class IC1(val x: Any) {
fun box() {}
fun box(x: Any) {}
fun unbox() {}
fun unbox(x: Any) {}
override fun equals(other: Any?): Boolean = true
override fun hashCode(): Int = 0
}
@JvmInline
value class IC2(val x: Any) {
fun box(x: Any) {}
fun box(): Any = TODO()
fun unbox(x: Any) {}
fun unbox(): Any = TODO()
fun equals(my: Any, other: Any): Boolean = true
fun hashCode(a: Any): Int = 0
}
@JvmInline
value class IC3(val x: Any) {
fun box(x: Any): Any = TODO()
fun unbox(x: Any): Any = TODO()
fun equals(): Boolean = true
}
interface WithBox {
fun box(): String
}
@JvmInline
value class IC4(val s: String) : WithBox {
override fun box(): String = ""
}
@JvmInline
value class IC5(val a: String) {
constructor(i: Int) : this(i.toString()) {
TODO("something")
}
}
@@ -0,0 +1,54 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin
annotation class JvmInline
@JvmInline
value class IC1(val x: Any) {
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>box<!>() {}
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>box<!>(x: Any) {}
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>unbox<!>() {}
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>unbox<!>(x: Any) {}
override fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>equals<!>(other: Any?): Boolean = true
override fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>hashCode<!>(): Int = 0
}
@JvmInline
value class IC2(val x: Any) {
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>box<!>(x: Any) {}
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>box<!>(): Any = TODO()
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>unbox<!>(x: Any) {}
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>unbox<!>(): Any = TODO()
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>equals<!>(my: Any, other: Any): Boolean = true
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>hashCode<!>(a: Any): Int = 0
}
@JvmInline
value class IC3(val x: Any) {
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>box<!>(x: Any): Any = TODO()
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>unbox<!>(x: Any): Any = TODO()
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>equals<!>(): Boolean = true
}
interface WithBox {
fun box(): String
}
@JvmInline
value class IC4(val s: String) : WithBox {
override fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>box<!>(): String = ""
}
@JvmInline
value class IC5(val a: String) {
constructor(i: Int) : this(i.toString()) <!SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS!>{<!>
TODO("something")
}
}
@@ -0,0 +1,73 @@
package
package kotlin {
@kotlin.JvmInline public final value class IC1 {
public constructor IC1(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(): kotlin.Unit
public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit
public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
public final fun unbox(): kotlin.Unit
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit
}
@kotlin.JvmInline public final value class IC2 {
public constructor IC2(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(): kotlin.Any
public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit
public final fun equals(/*0*/ my: kotlin.Any, /*1*/ other: kotlin.Any): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public final fun hashCode(/*0*/ a: kotlin.Any): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
public final fun unbox(): kotlin.Any
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit
}
@kotlin.JvmInline public final value class IC3 {
public constructor IC3(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(/*0*/ x: kotlin.Any): kotlin.Any
public final fun equals(): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Any
}
@kotlin.JvmInline public final value class IC4 : kotlin.WithBox {
public constructor IC4(/*0*/ s: kotlin.String)
public final val s: kotlin.String
public open override /*1*/ fun box(): kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class IC5 {
public constructor IC5(/*0*/ i: kotlin.Int)
public constructor IC5(/*0*/ a: kotlin.String)
public final val a: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface WithBox {
public abstract fun box(): kotlin.String
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,3 @@
val u1 = 1u
val u2 = 0xFu
val u3 = 0b1u
@@ -0,0 +1,3 @@
val u1 = <!UNSIGNED_LITERAL_WITHOUT_DECLARATIONS_ON_CLASSPATH!>1u<!>
val u2 = <!UNSIGNED_LITERAL_WITHOUT_DECLARATIONS_ON_CLASSPATH!>0xFu<!>
val u3 = <!UNSIGNED_LITERAL_WITHOUT_DECLARATIONS_ON_CLASSPATH!>0b1u<!>
@@ -0,0 +1,5 @@
package
public val u1: [ERROR : Type cannot be resolved. Please make sure you have the required dependencies for unsigned types in the classpath]
public val u2: [ERROR : Type cannot be resolved. Please make sure you have the required dependencies for unsigned types in the classpath]
public val u3: [ERROR : Type cannot be resolved. Please make sure you have the required dependencies for unsigned types in the classpath]
@@ -0,0 +1,20 @@
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
abstract class AbstractBaseClass
open class OpenBaseClass
interface BaseInterface
@JvmInline
value class TestExtendsAbstractClass(val x: Int) : AbstractBaseClass()
@JvmInline
value class TestExtendsOpenClass(val x: Int) : OpenBaseClass()
@JvmInline
value class TestImplementsInterface(val x: Int) : BaseInterface
@@ -0,0 +1,20 @@
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
abstract class AbstractBaseClass
open class OpenBaseClass
interface BaseInterface
@JvmInline
value class TestExtendsAbstractClass(val x: Int) : <!INLINE_CLASS_CANNOT_EXTEND_CLASSES!>AbstractBaseClass<!>()
@JvmInline
value class TestExtendsOpenClass(val x: Int) : <!INLINE_CLASS_CANNOT_EXTEND_CLASSES!>OpenBaseClass<!>()
@JvmInline
value class TestImplementsInterface(val x: Int) : BaseInterface
@@ -0,0 +1,55 @@
package
package kotlin {
public abstract class AbstractBaseClass {
public constructor AbstractBaseClass()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface BaseInterface {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public open class OpenBaseClass {
public constructor OpenBaseClass()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class TestExtendsAbstractClass : kotlin.AbstractBaseClass {
public constructor TestExtendsAbstractClass(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class TestExtendsOpenClass : kotlin.OpenBaseClass {
public constructor TestExtendsOpenClass(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class TestImplementsInterface : kotlin.BaseInterface {
public constructor TestImplementsInterface(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,15 @@
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
interface IFoo
object FooImpl : IFoo
@JvmInline
value class Test1(val x: Any) : IFoo by FooImpl
@JvmInline
value class Test2(val x: IFoo) : IFoo by x
@@ -0,0 +1,15 @@
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
interface IFoo
object FooImpl : IFoo
@JvmInline
value class Test1(val x: Any) : <!INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION!>IFoo by FooImpl<!>
@JvmInline
value class Test2(val x: IFoo) : <!INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION!>IFoo by x<!>
@@ -0,0 +1,40 @@
package
package kotlin {
public object FooImpl : kotlin.IFoo {
private constructor FooImpl()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface IFoo {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Test1 : kotlin.IFoo {
public constructor Test1(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Test2 : kotlin.IFoo {
public constructor Test2(/*0*/ x: kotlin.IFoo)
public final val x: kotlin.IFoo
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,9 @@
// FIR_IDENTICAL
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
@JvmInline
value class Test(val x: Int = 42)
@@ -0,0 +1,19 @@
package
package kotlin {
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Test {
public constructor Test(/*0*/ x: kotlin.Int = ...)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,51 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin
annotation class JvmInline
@JvmInline
value class A0(val x: Int)
@JvmInline
value class A1
@JvmInline
value class A2()
@JvmInline
value class A3(x: Int)
@JvmInline
value class A4(var x: Int)
@JvmInline
value class A5(val x: Int, val y: Int)
@JvmInline
value class A6(x: Int, val y: Int)
@JvmInline
value class A7(vararg val x: Int)
@JvmInline
value class A8(open val x: Int)
@JvmInline
value class A9(final val x: Int)
class B1 {
companion object {
@JvmInline
value class C1(val x: Int)
}
@JvmInline
value class C2(val x: Int)
}
object B2 {
@JvmInline
value class C3(val x: Int)
}
@JvmInline
final value class D0(val x: Int)
open value class D1(val x: Int)
abstract value class D2(val x: Int)
sealed value class D3(val x: Int)
<!INCOMPATIBLE_MODIFIERS!>value<!> <!INCOMPATIBLE_MODIFIERS!>data<!> class D4(val x: String)
@@ -0,0 +1,51 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin
annotation class JvmInline
@JvmInline
value class A0(val x: Int)
@JvmInline
<!ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS!>value<!> class A1
@JvmInline
value class A2<!INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE!>()<!>
@JvmInline
value class A3(<!INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER!>x: Int<!>)
@JvmInline
value class A4(<!INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER!>var x: Int<!>)
@JvmInline
value class A5<!INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE!>(val x: Int, val y: Int)<!>
@JvmInline
value class A6<!INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE!>(x: Int, val y: Int)<!>
@JvmInline
value class A7(<!INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER!>vararg val x: Int<!>)
@JvmInline
value class A8(<!INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER!><!NON_FINAL_MEMBER_IN_FINAL_CLASS!>open<!> val x: Int<!>)
@JvmInline
value class A9(final val x: Int)
class B1 {
companion object {
@JvmInline
<!INLINE_CLASS_NOT_TOP_LEVEL!>value<!> class C1(val x: Int)
}
@JvmInline
<!INLINE_CLASS_NOT_TOP_LEVEL!>value<!> class C2(val x: Int)
}
object B2 {
@JvmInline
<!INLINE_CLASS_NOT_TOP_LEVEL!>value<!> class C3(val x: Int)
}
@JvmInline
final value class D0(val x: Int)
<!INLINE_CLASS_NOT_FINAL!>open<!> value class D1(val x: Int)
<!INLINE_CLASS_NOT_FINAL!>abstract<!> value class D2(val x: Int)
<!INLINE_CLASS_NOT_FINAL!>sealed<!> value class D3(val x: Int)
<!INCOMPATIBLE_MODIFIERS, VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION!>value<!> <!INCOMPATIBLE_MODIFIERS!>data<!> class D4(val x: String)
@@ -0,0 +1,176 @@
package
package kotlin {
@kotlin.JvmInline public final value class A0 {
public constructor A0(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class A1 {
public constructor A1()
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class A2 {
public constructor A2()
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class A3 {
public constructor A3(/*0*/ x: kotlin.Int)
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class A4 {
public constructor A4(/*0*/ x: kotlin.Int)
public final var x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class A5 {
public constructor A5(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
public final val x: kotlin.Int
public final val y: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class A6 {
public constructor A6(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
public final val y: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class A7 {
public constructor A7(/*0*/ vararg x: kotlin.Int /*kotlin.IntArray*/)
public final val x: kotlin.IntArray
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class A8 {
public constructor A8(/*0*/ x: kotlin.Int)
public open val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class A9 {
public constructor A9(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final class B1 {
public constructor B1()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@kotlin.JvmInline public final value class C2 {
public constructor C2(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public companion object Companion {
private constructor Companion()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@kotlin.JvmInline public final value class C1 {
public constructor C1(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
}
public object B2 {
private constructor B2()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@kotlin.JvmInline public final value class C3 {
public constructor C3(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
@kotlin.JvmInline public final value class D0 {
public constructor D0(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public open value class D1 {
public constructor D1(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public abstract value class D2 {
public constructor D2(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public sealed value class D3 {
private constructor D3(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final data value class D4 {
public constructor D4(/*0*/ x: kotlin.String)
public final val x: kotlin.String
public final operator /*synthesized*/ fun component1(): kotlin.String
public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ...): kotlin.D4
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,19 @@
// FIR_IDENTICAL
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
@JvmInline
value class UInt(val x: Int)
@JvmInline
value class UIntArray(private val storage: IntArray) : Collection<UInt> {
public override val size: Int get() = storage.size
override operator fun iterator() = TODO()
override fun contains(element: UInt): Boolean = TODO()
override fun containsAll(elements: Collection<UInt>): Boolean = TODO()
override fun isEmpty(): Boolean = TODO()
}
@@ -0,0 +1,32 @@
package
package kotlin {
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class UInt {
public constructor UInt(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class UIntArray : kotlin.collections.Collection<kotlin.UInt> {
public constructor UIntArray(/*0*/ storage: kotlin.IntArray)
public open override /*1*/ val size: kotlin.Int
private final val storage: kotlin.IntArray
public open override /*1*/ fun contains(/*0*/ element: kotlin.UInt): kotlin.Boolean
public open override /*1*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection<kotlin.UInt>): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ fun isEmpty(): kotlin.Boolean
public open override /*1*/ fun iterator(): kotlin.Nothing
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,30 @@
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
@JvmInline
value class Foo<T>(val x: T)
@JvmInline
value class FooNullable<T>(val x: T?)
@JvmInline
value class FooGenericArray<T>(val x: Array<T>)
@JvmInline
value class FooGenericArray2<T>(val x: Array<Array<T>>)
@JvmInline
value class FooStarProjectedArray(val x: Array<*>)
@JvmInline
value class FooStarProjectedArray2(val x: Array<Array<*>>)
@JvmInline
value class Bar(val u: Unit)
@JvmInline
value class BarNullable(val u: Unit?)
@JvmInline
value class Baz(val u: Nothing)
@JvmInline
value class BazNullable(val u: Nothing?)
@@ -0,0 +1,30 @@
// !LANGUAGE: +InlineClasses
package kotlin
annotation class JvmInline
@JvmInline
value class Foo<T>(val x: <!INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE!>T<!>)
@JvmInline
value class FooNullable<T>(val x: <!INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE!>T?<!>)
@JvmInline
value class FooGenericArray<T>(val x: <!INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE!>Array<T><!>)
@JvmInline
value class FooGenericArray2<T>(val x: <!INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE!>Array<Array<T>><!>)
@JvmInline
value class FooStarProjectedArray(val x: Array<*>)
@JvmInline
value class FooStarProjectedArray2(val x: Array<Array<*>>)
@JvmInline
value class Bar(val u: <!INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE!>Unit<!>)
@JvmInline
value class BarNullable(val u: Unit?)
@JvmInline
value class Baz(val u: <!INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE!>Nothing<!>)
@JvmInline
value class BazNullable(val u: Nothing?)
@@ -0,0 +1,91 @@
package
package kotlin {
@kotlin.JvmInline public final value class Bar {
public constructor Bar(/*0*/ u: kotlin.Unit)
public final val u: kotlin.Unit
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class BarNullable {
public constructor BarNullable(/*0*/ u: kotlin.Unit?)
public final val u: kotlin.Unit?
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Baz {
public constructor Baz(/*0*/ u: kotlin.Nothing)
public final val u: kotlin.Nothing
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class BazNullable {
public constructor BazNullable(/*0*/ u: kotlin.Nothing?)
public final val u: kotlin.Nothing?
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Foo</*0*/ T> {
public constructor Foo</*0*/ T>(/*0*/ x: T)
public final val x: T
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class FooGenericArray</*0*/ T> {
public constructor FooGenericArray</*0*/ T>(/*0*/ x: kotlin.Array<T>)
public final val x: kotlin.Array<T>
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class FooGenericArray2</*0*/ T> {
public constructor FooGenericArray2</*0*/ T>(/*0*/ x: kotlin.Array<kotlin.Array<T>>)
public final val x: kotlin.Array<kotlin.Array<T>>
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class FooNullable</*0*/ T> {
public constructor FooNullable</*0*/ T>(/*0*/ x: T?)
public final val x: T?
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class FooStarProjectedArray {
public constructor FooStarProjectedArray(/*0*/ x: kotlin.Array<*>)
public final val x: kotlin.Array<*>
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class FooStarProjectedArray2 {
public constructor FooStarProjectedArray2(/*0*/ x: kotlin.Array<kotlin.Array<*>>)
public final val x: kotlin.Array<kotlin.Array<*>>
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,18 @@
// !LANGUAGE: +InlineClasses
package kotlin
import kotlin.reflect.KClass
annotation class JvmInline
@JvmInline
value class MyInt(val x: Int)
@JvmInline
value class MyString(val x: String)
annotation class Ann1(val a: <!INVALID_TYPE_OF_ANNOTATION_MEMBER!>MyInt<!>)
annotation class Ann2(val a: <!INVALID_TYPE_OF_ANNOTATION_MEMBER!>Array<MyString><!>)
annotation class Ann3(vararg val a: <!INVALID_TYPE_OF_ANNOTATION_MEMBER!>MyInt<!>)
annotation class Ann4(val a: KClass<MyInt>)
@@ -0,0 +1,18 @@
// !LANGUAGE: +InlineClasses
package kotlin
import kotlin.reflect.KClass
annotation class JvmInline
@JvmInline
value class MyInt(val x: Int)
@JvmInline
value class MyString(val x: String)
annotation class Ann1(val a: <!INVALID_TYPE_OF_ANNOTATION_MEMBER!>MyInt<!>)
annotation class Ann2(val a: <!INVALID_TYPE_OF_ANNOTATION_MEMBER!>Array<MyString><!>)
annotation class Ann3(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> val a: <!INVALID_TYPE_OF_ANNOTATION_MEMBER!>MyInt<!>)
annotation class Ann4(val a: KClass<MyInt>)
@@ -0,0 +1,59 @@
package
package kotlin {
public final annotation class Ann1 : kotlin.Annotation {
public constructor Ann1(/*0*/ a: kotlin.MyInt)
public final val a: kotlin.MyInt
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class Ann2 : kotlin.Annotation {
public constructor Ann2(/*0*/ a: kotlin.Array<kotlin.MyString>)
public final val a: kotlin.Array<kotlin.MyString>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class Ann3 : kotlin.Annotation {
public constructor Ann3(/*0*/ vararg a: kotlin.MyInt /*kotlin.Array<out kotlin.MyInt>*/)
public final val a: kotlin.Array<out kotlin.MyInt>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class Ann4 : kotlin.Annotation {
public constructor Ann4(/*0*/ a: kotlin.reflect.KClass<kotlin.MyInt>)
public final val a: kotlin.reflect.KClass<kotlin.MyInt>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class MyInt {
public constructor MyInt(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class MyString {
public constructor MyString(/*0*/ x: kotlin.String)
public final val x: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,26 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE, -UNUSED_ANONYMOUS_PARAMETER
package kotlin
annotation class JvmInline
@JvmInline
value class Foo(val x: Int)
fun f1(vararg a: Foo) {}
fun f2(vararg a: Foo?) {}
class A {
fun f3(a0: Int, vararg a1: Foo) {
fun f4(vararg a: Foo) {}
val g = fun (vararg v: Foo) {}
}
}
class B(vararg val s: Foo) {
constructor(a: Int, vararg s: Foo) : this(*s)
}
annotation class Ann(vararg val f: <!INVALID_TYPE_OF_ANNOTATION_MEMBER!>Foo<!>)
@@ -0,0 +1,26 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE, -UNUSED_ANONYMOUS_PARAMETER
package kotlin
annotation class JvmInline
@JvmInline
value class Foo(val x: Int)
fun f1(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> a: Foo) {}
fun f2(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> a: Foo?) {}
class A {
fun f3(a0: Int, <!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> a1: Foo) {
fun f4(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> a: Foo) {}
val g = fun (<!USELESS_VARARG_ON_PARAMETER!><!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> v: Foo<!>) {}
}
}
class B(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> val s: Foo) {
constructor(a: Int, <!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> s: Foo) : this(*s)
}
annotation class Ann(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> val f: <!INVALID_TYPE_OF_ANNOTATION_MEMBER!>Foo<!>)
@@ -0,0 +1,46 @@
package
package kotlin {
public fun f1(/*0*/ vararg a: kotlin.Foo /*kotlin.Array<out kotlin.Foo>*/): kotlin.Unit
public fun f2(/*0*/ vararg a: kotlin.Foo? /*kotlin.Array<out kotlin.Foo?>*/): kotlin.Unit
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun f3(/*0*/ a0: kotlin.Int, /*1*/ vararg a1: kotlin.Foo /*kotlin.Array<out kotlin.Foo>*/): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class Ann : kotlin.Annotation {
public constructor Ann(/*0*/ vararg f: kotlin.Foo /*kotlin.Array<out kotlin.Foo>*/)
public final val f: kotlin.Array<out kotlin.Foo>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class B {
public constructor B(/*0*/ vararg s: kotlin.Foo /*kotlin.Array<out kotlin.Foo>*/)
public constructor B(/*0*/ a: kotlin.Int, /*1*/ vararg s: kotlin.Foo /*kotlin.Array<out kotlin.Foo>*/)
public final val s: kotlin.Array<out kotlin.Foo>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.JvmInline public final value class Foo {
public constructor Foo(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -25050,6 +25050,129 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali
}
}
@TestMetadata("compiler/testData/diagnostics/tests/valueClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ValueClasses extends AbstractDiagnosticsTestWithFirValidation {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInValueClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/valueClasses"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("basicValueClassDeclaration.kt")
public void testBasicValueClassDeclaration() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt");
}
@TestMetadata("basicValueClassDeclarationDisabled.kt")
public void testBasicValueClassDeclarationDisabled() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt");
}
@TestMetadata("constructorsJvmSignaturesClash.kt")
public void testConstructorsJvmSignaturesClash() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt");
}
@TestMetadata("delegatedPropertyInValueClass.kt")
public void testDelegatedPropertyInValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt");
}
@TestMetadata("functionsJvmSignaturesClash.kt")
public void testFunctionsJvmSignaturesClash() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt");
}
@TestMetadata("functionsJvmSignaturesConflictOnInheritance.kt")
public void testFunctionsJvmSignaturesConflictOnInheritance() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt");
}
@TestMetadata("identityComparisonWithValueClasses.kt")
public void testIdentityComparisonWithValueClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt");
}
@TestMetadata("lateinitValueClasses.kt")
public void testLateinitValueClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt");
}
@TestMetadata("presenceOfInitializerBlockInsideValueClass.kt")
public void testPresenceOfInitializerBlockInsideValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt");
}
@TestMetadata("presenceOfPublicPrimaryConstructorForValueClass.kt")
public void testPresenceOfPublicPrimaryConstructorForValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt");
}
@TestMetadata("propertiesWithBackingFieldsInsideValueClass.kt")
public void testPropertiesWithBackingFieldsInsideValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt");
}
@TestMetadata("recursiveValueClasses.kt")
public void testRecursiveValueClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt");
}
@TestMetadata("reservedMembersAndConstructsInsideValueClass.kt")
public void testReservedMembersAndConstructsInsideValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt");
}
@TestMetadata("unsignedLiteralsWithoutArtifactOnClasspath.kt")
public void testUnsignedLiteralsWithoutArtifactOnClasspath() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt");
}
@TestMetadata("valueClassCanOnlyImplementInterfaces.kt")
public void testValueClassCanOnlyImplementInterfaces() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt");
}
@TestMetadata("valueClassCannotImplementInterfaceByDelegation.kt")
public void testValueClassCannotImplementInterfaceByDelegation() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt");
}
@TestMetadata("valueClassConstructorParameterWithDefaultValue.kt")
public void testValueClassConstructorParameterWithDefaultValue() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt");
}
@TestMetadata("valueClassDeclarationCheck.kt")
public void testValueClassDeclarationCheck() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt");
}
@TestMetadata("valueClassImplementsCollection.kt")
public void testValueClassImplementsCollection() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt");
}
@TestMetadata("valueClassWithForbiddenUnderlyingType.kt")
public void testValueClassWithForbiddenUnderlyingType() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt");
}
@TestMetadata("valueClassesInsideAnnotations.kt")
public void testValueClassesInsideAnnotations() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt");
}
@TestMetadata("varargsOnParametersOfValueClassType.kt")
public void testVarargsOnParametersOfValueClassType() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/tests/varargs")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -24970,6 +24970,129 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
}
}
@TestMetadata("compiler/testData/diagnostics/tests/valueClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ValueClasses extends AbstractDiagnosticsUsingJavacTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInValueClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/valueClasses"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("basicValueClassDeclaration.kt")
public void testBasicValueClassDeclaration() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclaration.kt");
}
@TestMetadata("basicValueClassDeclarationDisabled.kt")
public void testBasicValueClassDeclarationDisabled() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt");
}
@TestMetadata("constructorsJvmSignaturesClash.kt")
public void testConstructorsJvmSignaturesClash() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/constructorsJvmSignaturesClash.kt");
}
@TestMetadata("delegatedPropertyInValueClass.kt")
public void testDelegatedPropertyInValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt");
}
@TestMetadata("functionsJvmSignaturesClash.kt")
public void testFunctionsJvmSignaturesClash() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesClash.kt");
}
@TestMetadata("functionsJvmSignaturesConflictOnInheritance.kt")
public void testFunctionsJvmSignaturesConflictOnInheritance() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/functionsJvmSignaturesConflictOnInheritance.kt");
}
@TestMetadata("identityComparisonWithValueClasses.kt")
public void testIdentityComparisonWithValueClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/identityComparisonWithValueClasses.kt");
}
@TestMetadata("lateinitValueClasses.kt")
public void testLateinitValueClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/lateinitValueClasses.kt");
}
@TestMetadata("presenceOfInitializerBlockInsideValueClass.kt")
public void testPresenceOfInitializerBlockInsideValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt");
}
@TestMetadata("presenceOfPublicPrimaryConstructorForValueClass.kt")
public void testPresenceOfPublicPrimaryConstructorForValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/presenceOfPublicPrimaryConstructorForValueClass.kt");
}
@TestMetadata("propertiesWithBackingFieldsInsideValueClass.kt")
public void testPropertiesWithBackingFieldsInsideValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt");
}
@TestMetadata("recursiveValueClasses.kt")
public void testRecursiveValueClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt");
}
@TestMetadata("reservedMembersAndConstructsInsideValueClass.kt")
public void testReservedMembersAndConstructsInsideValueClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt");
}
@TestMetadata("unsignedLiteralsWithoutArtifactOnClasspath.kt")
public void testUnsignedLiteralsWithoutArtifactOnClasspath() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/unsignedLiteralsWithoutArtifactOnClasspath.kt");
}
@TestMetadata("valueClassCanOnlyImplementInterfaces.kt")
public void testValueClassCanOnlyImplementInterfaces() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt");
}
@TestMetadata("valueClassCannotImplementInterfaceByDelegation.kt")
public void testValueClassCannotImplementInterfaceByDelegation() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt");
}
@TestMetadata("valueClassConstructorParameterWithDefaultValue.kt")
public void testValueClassConstructorParameterWithDefaultValue() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassConstructorParameterWithDefaultValue.kt");
}
@TestMetadata("valueClassDeclarationCheck.kt")
public void testValueClassDeclarationCheck() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt");
}
@TestMetadata("valueClassImplementsCollection.kt")
public void testValueClassImplementsCollection() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassImplementsCollection.kt");
}
@TestMetadata("valueClassWithForbiddenUnderlyingType.kt")
public void testValueClassWithForbiddenUnderlyingType() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt");
}
@TestMetadata("valueClassesInsideAnnotations.kt")
public void testValueClassesInsideAnnotations() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/valueClassesInsideAnnotations.kt");
}
@TestMetadata("varargsOnParametersOfValueClassType.kt")
public void testVarargsOnParametersOfValueClassType() throws Exception {
runTest("compiler/testData/diagnostics/tests/valueClasses/varargsOnParametersOfValueClassType.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/tests/varargs")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.builtins.isSuspendFunctionType
import org.jetbrains.kotlin.builtins.transformSuspendFunctionToRuntimeFunctionType
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.name.SpecialNames
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.checker.SimpleClassicTypeSystemContext
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithStarProjections
@@ -115,7 +116,7 @@ fun <T : Any> mapType(
descriptor is ClassDescriptor -> {
// NB if inline class is recursive, it's ok to map it as wrapped
if (descriptor.isInline && !mode.needInlineClassWrapping) {
if (descriptor.isInlineClass() && !mode.needInlineClassWrapping) {
val expandedType = SimpleClassicTypeSystemContext.computeExpandedTypeForInlineClass(kotlinType) as KotlinType?
if (expandedType != null) {
return mapType(
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.types.typeUtil.representativeUpperBound
fun shouldHideConstructorDueToInlineClassTypeValueParameters(descriptor: CallableMemberDescriptor): Boolean {
val constructorDescriptor = descriptor as? ClassConstructorDescriptor ?: return false
if (DescriptorVisibilities.isPrivate(constructorDescriptor.visibility)) return false
if (constructorDescriptor.constructedClass.isInline) return false
if (constructorDescriptor.constructedClass.isInlineClass()) return false
if (DescriptorUtils.isSealedClass(constructorDescriptor.constructedClass)) return false
// TODO inner class in inline class
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils.getContainingClass
import org.jetbrains.kotlin.resolve.constants.ConstantValue
import org.jetbrains.kotlin.resolve.constants.EnumValue
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.types.KotlinType
@@ -445,7 +446,7 @@ fun DeclarationDescriptor.isAnnotationConstructor(): Boolean =
this is ConstructorDescriptor && DescriptorUtils.isAnnotationClass(this.constructedClass)
fun DeclarationDescriptor.isPrimaryConstructorOfInlineClass(): Boolean =
this is ConstructorDescriptor && this.isPrimary && this.constructedClass.isInline
this is ConstructorDescriptor && this.isPrimary && this.constructedClass.isInlineClass()
@TypeRefinement
fun ModuleDescriptor.getKotlinTypeRefiner(): KotlinTypeRefiner = getCapability(REFINER_CAPABILITY)?.value ?: KotlinTypeRefiner.Default
@@ -6,18 +6,23 @@
package org.jetbrains.kotlin.resolve
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeSubstitutor
import org.jetbrains.kotlin.types.TypeUtils
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
val JVM_INLINE_ANNOTATION = FqName("kotlin.JvmInline")
fun ClassDescriptor.underlyingRepresentation(): ValueParameterDescriptor? {
if (!isInline) return null
if (!isInlineClass()) return null
return unsubstitutedPrimaryConstructor?.valueParameters?.singleOrNull()
}
fun DeclarationDescriptor.isInlineClass() = this is ClassDescriptor && this.isInline
// FIXME: DeserializedClassDescriptor in reflection do not have @JvmInline annotation, that we
// FIXME: would like to check as well.
fun DeclarationDescriptor.isInlineClass() = this is ClassDescriptor && (isInline || isValue)
fun KotlinType.unsubstitutedUnderlyingParameter(): ValueParameterDescriptor? {
return constructor.declarationDescriptor.safeAs<ClassDescriptor>()?.underlyingRepresentation()
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.descriptorUtil.hasExactAnnotation
import org.jetbrains.kotlin.resolve.descriptorUtil.hasNoInferAnnotation
import org.jetbrains.kotlin.resolve.descriptorUtil.isExactAnnotation
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.resolve.substitutedUnderlyingType
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.model.*
@@ -599,7 +600,7 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
override fun TypeConstructorMarker.isInlineClass(): Boolean {
require(this is TypeConstructor, this::errorMessage)
return (declarationDescriptor as? ClassDescriptor)?.isInline == true
return (declarationDescriptor as? ClassDescriptor)?.isInlineClass() == true
}
override fun TypeConstructorMarker.isInnerClass(): Boolean {
@@ -90,7 +90,7 @@ internal class InlineClassAwareCaller<out M : Member?>(
}
} else {
val containingDeclaration = descriptor.containingDeclaration
if (containingDeclaration is ClassDescriptor && containingDeclaration.isInline) {
if (containingDeclaration is ClassDescriptor && containingDeclaration.isInlineClass()) {
kotlinParameterTypes.add(containingDeclaration.defaultType)
}
}
@@ -180,7 +180,7 @@ internal fun KotlinType.toInlineClass(): Class<*>? =
constructor.declarationDescriptor.toInlineClass()
internal fun DeclarationDescriptor?.toInlineClass(): Class<*>? =
if (this is ClassDescriptor && isInline)
if (this is ClassDescriptor && isInlineClass())
toJavaClass() ?: throw KotlinReflectionInternalError("Class object for the class $name cannot be found (classId=$classId)")
else
null
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtNamedDeclaration
import org.jetbrains.kotlin.psi.KtTypeParameter
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameOrNull
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeProjection
import org.jetbrains.kotlin.types.isError
@@ -101,7 +102,7 @@ private fun DeclarationDescriptor.collectAllTypes(): Sequence<FqName?> {
return when (this) {
is ClassConstructorDescriptor -> valueParameters.asSequence().map(ValueParameterDescriptor::getType)
.flatMap(KotlinType::collectAllTypes)
is ClassDescriptor -> if (isInline) unsubstitutedPrimaryConstructor?.collectAllTypes().orEmpty() else {
is ClassDescriptor -> if (isInlineClass()) unsubstitutedPrimaryConstructor?.collectAllTypes().orEmpty() else {
emptySequence()
} + declaredTypeParameters.asSequence().flatMap(DeclarationDescriptor::collectAllTypes) + sequenceOf(fqNameOrNull())
is CallableDescriptor -> {
@@ -144,7 +144,7 @@ fun OverrideMemberChooserObject.generateMember(
val renderer = baseRenderer.withOptions {
if (descriptor is ClassConstructorDescriptor && descriptor.isPrimary) {
val containingClass = descriptor.containingDeclaration
if (containingClass.kind == ClassKind.ANNOTATION_CLASS || containingClass.isInline) {
if (containingClass.kind == ClassKind.ANNOTATION_CLASS || containingClass.isInline || containingClass.isValue) {
renderPrimaryConstructorParametersAsProperties = true
}
}
@@ -76,6 +76,7 @@ import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.resolve.isInlineClassType
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
import org.jetbrains.kotlin.util.findCallableMemberBySignature
@@ -513,7 +514,7 @@ class UnusedSymbolInspection : AbstractKotlinInspection() {
return when {
descriptor is ConstructorDescriptor -> {
val classDescriptor = descriptor.constructedClass
!classDescriptor.isInline && classDescriptor.visibility != DescriptorVisibilities.LOCAL
!classDescriptor.isInlineClass() && classDescriptor.visibility != DescriptorVisibilities.LOCAL
}
hasModifier(KtTokens.INTERNAL_KEYWORD) -> false
descriptor !is FunctionDescriptor -> true
@@ -44,6 +44,7 @@ object JsExternalChecker : DeclarationChecker {
descriptor.isData -> "data class"
descriptor.isInner -> "inner class"
descriptor.isInline -> "inline class"
descriptor.isValue -> "value class"
descriptor.isFun -> "fun interface"
DescriptorUtils.isAnnotationClass(descriptor) -> "annotation class"
else -> null
@@ -131,7 +131,7 @@ class ClassTranslator private constructor(
if (classDeclaration is KtClassOrObject) {
when {
descriptor.isData -> JsDataClassGenerator(classDeclaration, context).generate()
descriptor.isInline -> JsInlineClassGenerator(classDeclaration, context).generate()
descriptor.isInline || descriptor.isValue -> JsInlineClassGenerator(classDeclaration, context).generate()
}
}
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.descriptors.commonizer.cir.impl.CirClassImpl
import org.jetbrains.kotlin.descriptors.commonizer.utils.compactMap
import org.jetbrains.kotlin.descriptors.commonizer.utils.intern
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.isInlineClass
object CirClassFactory {
fun create(source: ClassDescriptor): CirClass = create(
@@ -28,7 +29,7 @@ object CirClassFactory {
companion = source.companionObjectDescriptor?.name?.intern(),
isCompanion = source.isCompanionObject,
isData = source.isData,
isInline = source.isInline,
isInline = source.isInlineClass(),
isInner = source.isInner,
isExternal = source.isExternal
).apply {
@@ -229,6 +229,7 @@ internal class ComparingDeclarationsVisitor(
context.assertFieldsEqual(expected::isCompanionObject, actual::isCompanionObject)
context.assertFieldsEqual(expected::isData, actual::isData)
context.assertFieldsEqual(expected::isInline, actual::isInline)
context.assertFieldsEqual(expected::isValue, actual::isValue)
context.assertFieldsEqual(expected::isInner, actual::isInner)
context.assertFieldsEqual(expected::isExternal, actual::isExternal)
context.assertFieldsEqual(expected::isExpect, actual::isExpect)
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassOrAny
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperInterfaces
import org.jetbrains.kotlin.resolve.descriptorUtil.module
import org.jetbrains.kotlin.resolve.hasBackingField
import org.jetbrains.kotlin.resolve.isInlineClass
import org.jetbrains.kotlin.resolve.isInlineClassType
import org.jetbrains.kotlin.resolve.jvm.annotations.TRANSIENT_ANNOTATION_FQ_NAME
import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor
@@ -122,7 +123,7 @@ open class SerializationPluginDeclarationChecker : DeclarationChecker {
return false
}
if (descriptor.isInline) {
if (descriptor.isInlineClass()) {
trace.reportOnSerializableAnnotation(descriptor, SerializationErrors.INLINE_CLASSES_NOT_SUPPORTED)
return false
}