Mark expect/actual classifiers as experimental

^KT-61573 Fixed
Review: https://jetbrains.team/p/kt/reviews/11969/timeline

Tests:
- MultiPlatformIntegrationTestGenerated
- CliTestGenerated
- MultiPlatformIntegrationTestGenerated
- DiagnosticTestGenerated.Multiplatform
- FirLightTreeOldFrontendDiagnosticsTestGenerated

Also add -Xexpect-actual-classes flag to all necessary ./libraries/* modules
Otherwise compilation of those modules failes because of `-Werror`
This commit is contained in:
Nikita Bobko
2023-08-30 15:39:19 +02:00
committed by Space Team
parent 6a19c4ce96
commit 01fc708a0f
68 changed files with 633 additions and 5 deletions
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.psi.KtBinaryExpression
import org.jetbrains.kotlin.psi.KtBinaryExpressionWithTypeRHS import org.jetbrains.kotlin.psi.KtBinaryExpressionWithTypeRHS
import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtClass import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassLikeDeclaration
import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtConstructor import org.jetbrains.kotlin.psi.KtConstructor
import org.jetbrains.kotlin.psi.KtConstructorDelegationCall import org.jetbrains.kotlin.psi.KtConstructorDelegationCall
@@ -3666,6 +3667,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token, token,
) )
} }
add(FirErrors.EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING) { firDiagnostic ->
ExpectActualClassifiersAreExperimentalWarningImpl(
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.NOT_A_MULTIPLATFORM_COMPILATION) { firDiagnostic -> add(FirErrors.NOT_A_MULTIPLATFORM_COMPILATION) { firDiagnostic ->
NotAMultiplatformCompilationImpl( NotAMultiplatformCompilationImpl(
firDiagnostic as KtPsiDiagnostic, firDiagnostic as KtPsiDiagnostic,
@@ -43,6 +43,7 @@ import org.jetbrains.kotlin.psi.KtBinaryExpression
import org.jetbrains.kotlin.psi.KtBinaryExpressionWithTypeRHS import org.jetbrains.kotlin.psi.KtBinaryExpressionWithTypeRHS
import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtClass import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassLikeDeclaration
import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtConstructor import org.jetbrains.kotlin.psi.KtConstructor
import org.jetbrains.kotlin.psi.KtConstructorDelegationCall import org.jetbrains.kotlin.psi.KtConstructorDelegationCall
@@ -2565,6 +2566,10 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = ActualMissing::class override val diagnosticClass get() = ActualMissing::class
} }
interface ExpectActualClassifiersAreExperimentalWarning : KtFirDiagnostic<KtClassLikeDeclaration> {
override val diagnosticClass get() = ExpectActualClassifiersAreExperimentalWarning::class
}
interface NotAMultiplatformCompilation : KtFirDiagnostic<PsiElement> { interface NotAMultiplatformCompilation : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = NotAMultiplatformCompilation::class override val diagnosticClass get() = NotAMultiplatformCompilation::class
} }
@@ -44,6 +44,7 @@ import org.jetbrains.kotlin.psi.KtBinaryExpression
import org.jetbrains.kotlin.psi.KtBinaryExpressionWithTypeRHS import org.jetbrains.kotlin.psi.KtBinaryExpressionWithTypeRHS
import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtClass import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassLikeDeclaration
import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtConstructor import org.jetbrains.kotlin.psi.KtConstructor
import org.jetbrains.kotlin.psi.KtConstructorDelegationCall import org.jetbrains.kotlin.psi.KtConstructorDelegationCall
@@ -3092,6 +3093,11 @@ internal class ActualMissingImpl(
token: KtLifetimeToken, token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtNamedDeclaration>(firDiagnostic, token), KtFirDiagnostic.ActualMissing ) : KtAbstractFirDiagnostic<KtNamedDeclaration>(firDiagnostic, token), KtFirDiagnostic.ActualMissing
internal class ExpectActualClassifiersAreExperimentalWarningImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtClassLikeDeclaration>(firDiagnostic, token), KtFirDiagnostic.ExpectActualClassifiersAreExperimentalWarning
internal class NotAMultiplatformCompilationImpl( internal class NotAMultiplatformCompilationImpl(
firDiagnostic: KtPsiDiagnostic, firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken, token: KtLifetimeToken,
@@ -31,6 +31,7 @@ fun copyCommonCompilerArguments(from: CommonCompilerArguments, to: CommonCompile
to.effectSystem = from.effectSystem to.effectSystem = from.effectSystem
to.enableBuilderInference = from.enableBuilderInference to.enableBuilderInference = from.enableBuilderInference
to.enableSignatureClashChecks = from.enableSignatureClashChecks to.enableSignatureClashChecks = from.enableSignatureClashChecks
to.expectActualClasses = from.expectActualClasses
to.expectActualLinker = from.expectActualLinker to.expectActualLinker = from.expectActualLinker
to.experimental = from.experimental?.copyOf() to.experimental = from.experimental?.copyOf()
to.explicitApi = from.explicitApi to.explicitApi = from.explicitApi
@@ -632,6 +632,17 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
field = value field = value
} }
@Argument(
value = "-Xexpect-actual-classes",
description = "The expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature.\n" +
"Kotlin reports a warning every time you use them. You can use this flag to mute the warning."
)
var expectActualClasses = false
set(value) {
checkFrozen()
field = value
}
@Argument( @Argument(
value = "-Xunrestricted-builder-inference", value = "-Xunrestricted-builder-inference",
description = "Eliminate builder inference restrictions like allowance of returning type variables of a builder inference call" description = "Eliminate builder inference restrictions like allowance of returning type variables of a builder inference call"
@@ -796,6 +807,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
put(AnalysisFlags.extendedCompilerChecks, extendedCompilerChecks) put(AnalysisFlags.extendedCompilerChecks, extendedCompilerChecks)
put(AnalysisFlags.allowKotlinPackage, allowKotlinPackage) put(AnalysisFlags.allowKotlinPackage, allowKotlinPackage)
put(AnalysisFlags.builtInsFromSources, builtInsFromSources) put(AnalysisFlags.builtInsFromSources, builtInsFromSources)
put(AnalysisFlags.muteExpectActualClassesWarning, expectActualClasses)
put(AnalysisFlags.allowFullyQualifiedNameInKClass, true) put(AnalysisFlags.allowFullyQualifiedNameInKClass, true)
put(AnalysisFlags.dontWarnOnErrorSuppression, dontWarnOnErrorSuppression) put(AnalysisFlags.dontWarnOnErrorSuppression, dontWarnOnErrorSuppression)
} }
@@ -54,6 +54,9 @@ object AnalysisFlags {
@JvmStatic @JvmStatic
val builtInsFromSources by AnalysisFlag.Delegates.Boolean val builtInsFromSources by AnalysisFlag.Delegates.Boolean
@JvmStatic
val muteExpectActualClassesWarning by AnalysisFlag.Delegates.Boolean
@JvmStatic @JvmStatic
val allowFullyQualifiedNameInKClass by AnalysisFlag.Delegates.Boolean val allowFullyQualifiedNameInKClass by AnalysisFlag.Delegates.Boolean
@@ -121,6 +121,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst
runTest("compiler/testData/diagnostics/tests/multiplatform/expectAbstractToString.kt"); runTest("compiler/testData/diagnostics/tests/multiplatform/expectAbstractToString.kt");
} }
@Test
@TestMetadata("expectActualClassesAreExperimentalWarning.kt")
public void testExpectActualClassesAreExperimentalWarning() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/expectActualClassesAreExperimentalWarning.kt");
}
@Test @Test
@TestMetadata("expectDataObject.kt") @TestMetadata("expectDataObject.kt")
public void testExpectDataObject() throws Exception { public void testExpectDataObject() throws Exception {
@@ -121,6 +121,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi
runTest("compiler/testData/diagnostics/tests/multiplatform/expectAbstractToString.kt"); runTest("compiler/testData/diagnostics/tests/multiplatform/expectAbstractToString.kt");
} }
@Test
@TestMetadata("expectActualClassesAreExperimentalWarning.kt")
public void testExpectActualClassesAreExperimentalWarning() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/expectActualClassesAreExperimentalWarning.kt");
}
@Test @Test
@TestMetadata("expectDataObject.kt") @TestMetadata("expectDataObject.kt")
public void testExpectDataObject() throws Exception { public void testExpectDataObject() throws Exception {
@@ -1254,6 +1254,8 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") {
val ACTUAL_MISSING by error<KtNamedDeclaration>(PositioningStrategy.ACTUAL_DECLARATION_NAME) val ACTUAL_MISSING by error<KtNamedDeclaration>(PositioningStrategy.ACTUAL_DECLARATION_NAME)
val EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING by warning<KtClassLikeDeclaration>(PositioningStrategy.EXPECT_ACTUAL_MODIFIER)
val NOT_A_MULTIPLATFORM_COMPILATION by error<PsiElement>() val NOT_A_MULTIPLATFORM_COMPILATION by error<PsiElement>()
val EXPECT_ACTUAL_OPT_IN_ANNOTATION by error<KtNamedDeclaration>(PositioningStrategy.EXPECT_ACTUAL_MODIFIER) val EXPECT_ACTUAL_OPT_IN_ANNOTATION by error<KtNamedDeclaration>(PositioningStrategy.EXPECT_ACTUAL_MODIFIER)
@@ -68,6 +68,7 @@ import org.jetbrains.kotlin.psi.KtBinaryExpression
import org.jetbrains.kotlin.psi.KtBinaryExpressionWithTypeRHS import org.jetbrains.kotlin.psi.KtBinaryExpressionWithTypeRHS
import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtClass import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassLikeDeclaration
import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtConstructor import org.jetbrains.kotlin.psi.KtConstructor
import org.jetbrains.kotlin.psi.KtConstructorDelegationCall import org.jetbrains.kotlin.psi.KtConstructorDelegationCall
@@ -656,6 +657,7 @@ object FirErrors {
val AMBIGUOUS_EXPECTS by error2<KtNamedDeclaration, FirBasedSymbol<*>, Collection<FirModuleData>>(SourceElementPositioningStrategies.INCOMPATIBLE_DECLARATION) val AMBIGUOUS_EXPECTS by error2<KtNamedDeclaration, FirBasedSymbol<*>, Collection<FirModuleData>>(SourceElementPositioningStrategies.INCOMPATIBLE_DECLARATION)
val NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS by error2<KtNamedDeclaration, FirBasedSymbol<*>, List<Pair<FirBasedSymbol<*>, Map<Incompatible<FirBasedSymbol<*>>, Collection<FirBasedSymbol<*>>>>>>(SourceElementPositioningStrategies.ACTUAL_DECLARATION_NAME) val NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS by error2<KtNamedDeclaration, FirBasedSymbol<*>, List<Pair<FirBasedSymbol<*>, Map<Incompatible<FirBasedSymbol<*>>, Collection<FirBasedSymbol<*>>>>>>(SourceElementPositioningStrategies.ACTUAL_DECLARATION_NAME)
val ACTUAL_MISSING by error0<KtNamedDeclaration>(SourceElementPositioningStrategies.ACTUAL_DECLARATION_NAME) val ACTUAL_MISSING by error0<KtNamedDeclaration>(SourceElementPositioningStrategies.ACTUAL_DECLARATION_NAME)
val EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING by warning0<KtClassLikeDeclaration>(SourceElementPositioningStrategies.EXPECT_ACTUAL_MODIFIER)
val NOT_A_MULTIPLATFORM_COMPILATION by error0<PsiElement>() val NOT_A_MULTIPLATFORM_COMPILATION by error0<PsiElement>()
val EXPECT_ACTUAL_OPT_IN_ANNOTATION by error0<KtNamedDeclaration>(SourceElementPositioningStrategies.EXPECT_ACTUAL_MODIFIER) val EXPECT_ACTUAL_OPT_IN_ANNOTATION by error0<KtNamedDeclaration>(SourceElementPositioningStrategies.EXPECT_ACTUAL_MODIFIER)
val ACTUAL_TYPEALIAS_TO_SPECIAL_ANNOTATION by error1<KtTypeAlias, ClassId>(SourceElementPositioningStrategies.TYPEALIAS_TYPE_REFERENCE) val ACTUAL_TYPEALIAS_TO_SPECIAL_ANNOTATION by error1<KtTypeAlias, ClassId>(SourceElementPositioningStrategies.TYPEALIAS_TYPE_REFERENCE)
@@ -34,7 +34,12 @@ object CommonDeclarationCheckers : DeclarationCheckers() {
FirPublishedApiChecker, FirPublishedApiChecker,
FirOptInMarkedDeclarationChecker, FirOptInMarkedDeclarationChecker,
FirExpectConsistencyChecker, FirExpectConsistencyChecker,
FirOptionalExpectationDeclarationChecker FirOptionalExpectationDeclarationChecker,
)
override val classLikeCheckers: Set<FirClassLikeChecker>
get() = setOf(
FirExpectActualClassifiersAreExperimentalChecker,
) )
override val callableDeclarationCheckers: Set<FirCallableDeclarationChecker> override val callableDeclarationCheckers: Set<FirCallableDeclarationChecker>
@@ -0,0 +1,27 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
import org.jetbrains.kotlin.config.AnalysisFlags
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.diagnostics.reportOn
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.utils.isActual
import org.jetbrains.kotlin.fir.declarations.utils.isExpect
object FirExpectActualClassifiersAreExperimentalChecker : FirClassLikeChecker() {
override fun check(declaration: FirClassLikeDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
if (!context.languageVersionSettings.supportsFeature(LanguageFeature.MultiPlatformProjects)) return
if (context.languageVersionSettings.getFlag(AnalysisFlags.muteExpectActualClassesWarning)) return
if (declaration.isExpect || declaration.isActual) {
reporter.reportOn(declaration.source, FirErrors.EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING, context)
}
}
}
@@ -227,6 +227,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPECTED_LATEINIT
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPECTED_PRIVATE_DECLARATION import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPECTED_PRIVATE_DECLARATION
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPECTED_PROPERTY_INITIALIZER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPECTED_PROPERTY_INITIALIZER
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPECTED_TAILREC_FUNCTION import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPECTED_TAILREC_FUNCTION
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPECT_ACTUAL_OPT_IN_ANNOTATION import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPECT_ACTUAL_OPT_IN_ANNOTATION
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPECT_CLASS_AS_FUNCTION import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPECT_CLASS_AS_FUNCTION
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPLICIT_BACKING_FIELD_IN_ABSTRACT_PROPERTY import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPLICIT_BACKING_FIELD_IN_ABSTRACT_PROPERTY
@@ -1984,6 +1985,11 @@ object FirErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
FirIncompatibleExpectedActualClassScopesRenderer.TEXT FirIncompatibleExpectedActualClassScopesRenderer.TEXT
) )
map.put(ACTUAL_MISSING, "Declaration must be marked with 'actual'.") map.put(ACTUAL_MISSING, "Declaration must be marked with 'actual'.")
map.put(
EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING,
"The expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. " +
"You can use -Xexpect-actual-classes flag to suppress this warning."
)
map.put(NOT_A_MULTIPLATFORM_COMPILATION, "'expect' and 'actual' declarations can be used only in multiplatform projects. Learn more about Kotlin Multiplatform: https://kotl.in/multiplatform-setup") map.put(NOT_A_MULTIPLATFORM_COMPILATION, "'expect' and 'actual' declarations can be used only in multiplatform projects. Learn more about Kotlin Multiplatform: https://kotl.in/multiplatform-setup")
map.put(EXPECT_ACTUAL_OPT_IN_ANNOTATION, "Opt-in annotations are prohibited to be 'expect' or 'actual'. Instead, declare annotation once in common sources.") map.put(EXPECT_ACTUAL_OPT_IN_ANNOTATION, "Opt-in annotations are prohibited to be 'expect' or 'actual'. Instead, declare annotation once in common sources.")
map.put( map.put(
@@ -866,6 +866,8 @@ public interface Errors {
ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER = ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER =
DiagnosticFactory3.create(ERROR, DECLARATION_NAME); DiagnosticFactory3.create(ERROR, DECLARATION_NAME);
DiagnosticFactory0<KtClassLikeDeclaration> EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING = DiagnosticFactory0.create(WARNING, EXPECT_ACTUAL_MODIFIER);
DiagnosticFactory0<PsiElement> OPTIONAL_EXPECTATION_NOT_ON_EXPECTED = DiagnosticFactory0.create(ERROR); DiagnosticFactory0<PsiElement> OPTIONAL_EXPECTATION_NOT_ON_EXPECTED = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement> OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY = DiagnosticFactory0.create(ERROR); DiagnosticFactory0<PsiElement> OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement> OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0<PsiElement> OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE = DiagnosticFactory0.create(ERROR);
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.diagnostics.Errors;
import org.jetbrains.kotlin.diagnostics.UnboundDiagnostic; import org.jetbrains.kotlin.diagnostics.UnboundDiagnostic;
import org.jetbrains.kotlin.metadata.deserialization.VersionRequirement; import org.jetbrains.kotlin.metadata.deserialization.VersionRequirement;
import org.jetbrains.kotlin.resolve.VarianceConflictDiagnosticData; import org.jetbrains.kotlin.resolve.VarianceConflictDiagnosticData;
import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility;
import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility.Incompatible; import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility.Incompatible;
import org.jetbrains.kotlin.types.KotlinTypeKt; import org.jetbrains.kotlin.types.KotlinTypeKt;
import org.jetbrains.kotlin.util.OperatorNameConventions; import org.jetbrains.kotlin.util.OperatorNameConventions;
@@ -431,6 +430,10 @@ public class DefaultErrorMessages {
new ListRenderer<>(TO_STRING, (elem) -> "'" + elem + "'"), new ListRenderer<>(TO_STRING, (elem) -> "'" + elem + "'"),
NAME); NAME);
MAP.put(EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING,
"The expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. " +
"You can use -Xexpect-actual-classes flag to suppress this warning.");
MAP.put(OPTIONAL_EXPECTATION_NOT_ON_EXPECTED, "'@OptionalExpectation' can only be used on an expected annotation class"); MAP.put(OPTIONAL_EXPECTATION_NOT_ON_EXPECTED, "'@OptionalExpectation' can only be used on an expected annotation class");
MAP.put(OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY, "Declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry"); MAP.put(OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY, "Declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry");
MAP.put(OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE, "Declaration annotated with '@OptionalExpectation' can only be used in common module sources"); MAP.put(OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE, "Declaration annotated with '@OptionalExpectation' can only be used in common module sources");
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.types.DynamicTypesSettings
private val DEFAULT_DECLARATION_CHECKERS = listOf( private val DEFAULT_DECLARATION_CHECKERS = listOf(
ExpectActualInTheSameModuleChecker, ExpectActualInTheSameModuleChecker,
ActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker, ActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker,
ExpectActualClassifiersAreExperimentalChecker,
DataClassDeclarationChecker(), DataClassDeclarationChecker(),
ConstModifierChecker, ConstModifierChecker,
UnderscoreChecker, UnderscoreChecker,
@@ -0,0 +1,37 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.resolve.checkers
import org.jetbrains.kotlin.config.AnalysisFlags
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassifierDescriptorWithTypeParameters
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.psi.KtClassLikeDeclaration
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtTypeAlias
object ExpectActualClassifiersAreExperimentalChecker : DeclarationChecker {
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
if (!context.languageVersionSettings.supportsFeature(LanguageFeature.MultiPlatformProjects)) return
if (context.languageVersionSettings.getFlag(AnalysisFlags.muteExpectActualClassesWarning)) return
if (descriptor !is TypeAliasDescriptor && descriptor !is ClassDescriptor) return
check(declaration is KtClassOrObject || declaration is KtTypeAlias)
// Common supertype of KtTypeAlias and KtClassOrObject is KtClassLikeDeclaration.
// Common supertype of TypeAliasDescriptor and ClassDescriptor is ClassifierDescriptorWithTypeParameters.
// The explicit casts won't be necessary when we start compiling kotlin with K2.
check(declaration is KtClassLikeDeclaration)
check(descriptor is ClassifierDescriptorWithTypeParameters)
if (descriptor.isExpect || descriptor.isActual) {
context.trace.report(Errors.EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING.on(declaration))
}
}
}
@@ -103,6 +103,7 @@ class LanguageVersionSettingsBuilder {
analysisFlag(AnalysisFlags.allowResultReturnType, trueOrNull(LanguageSettingsDirectives.ALLOW_RESULT_RETURN_TYPE in directives)), analysisFlag(AnalysisFlags.allowResultReturnType, trueOrNull(LanguageSettingsDirectives.ALLOW_RESULT_RETURN_TYPE in directives)),
analysisFlag(AnalysisFlags.explicitApiMode, directives.singleOrZeroValue(LanguageSettingsDirectives.EXPLICIT_API_MODE)), analysisFlag(AnalysisFlags.explicitApiMode, directives.singleOrZeroValue(LanguageSettingsDirectives.EXPLICIT_API_MODE)),
analysisFlag(AnalysisFlags.allowKotlinPackage, trueOrNull(LanguageSettingsDirectives.ALLOW_KOTLIN_PACKAGE in directives)), analysisFlag(AnalysisFlags.allowKotlinPackage, trueOrNull(LanguageSettingsDirectives.ALLOW_KOTLIN_PACKAGE in directives)),
analysisFlag(AnalysisFlags.muteExpectActualClassesWarning, trueOrNull(LanguageSettingsDirectives.ENABLE_EXPECT_ACTUAL_CLASSES_WARNING in directives) != true),
analysisFlag(AnalysisFlags.dontWarnOnErrorSuppression, trueOrNull(LanguageSettingsDirectives.DONT_WARN_ON_ERROR_SUPPRESSION in directives)), analysisFlag(AnalysisFlags.dontWarnOnErrorSuppression, trueOrNull(LanguageSettingsDirectives.DONT_WARN_ON_ERROR_SUPPRESSION in directives)),
analysisFlag(JvmAnalysisFlags.jvmDefaultMode, directives.singleOrZeroValue(LanguageSettingsDirectives.JVM_DEFAULT_MODE)), analysisFlag(JvmAnalysisFlags.jvmDefaultMode, directives.singleOrZeroValue(LanguageSettingsDirectives.JVM_DEFAULT_MODE)),
@@ -64,6 +64,11 @@ object LanguageSettingsDirectives : SimpleDirectivesContainer() {
description = "Allow compiling code in package 'kotlin' and allow not requiring kotlin.stdlib in module-info (AnalysisFlags.allowKotlinPackage)" description = "Allow compiling code in package 'kotlin' and allow not requiring kotlin.stdlib in module-info (AnalysisFlags.allowKotlinPackage)"
) )
// It's inverted because otherwise we would have warnings in almost all KMP tests
val ENABLE_EXPECT_ACTUAL_CLASSES_WARNING by stringDirective(
description = "Disables -Xexpect-actual-classes key"
)
// --------------------- Jvm Analysis Flags --------------------- // --------------------- Jvm Analysis Flags ---------------------
val JVM_DEFAULT_MODE by enumDirective( val JVM_DEFAULT_MODE by enumDirective(
+2
View File
@@ -87,6 +87,8 @@ where advanced options include:
The corresponding calls' declarations may not be marked with @BuilderInference. The corresponding calls' declarations may not be marked with @BuilderInference.
-Xklib-enable-signature-clash-checks -Xklib-enable-signature-clash-checks
Enable the checks on uniqueness of signatures Enable the checks on uniqueness of signatures
-Xexpect-actual-classes The expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature.
Kotlin reports a warning every time you use them. You can use this flag to mute the warning.
-Xexpect-actual-linker Enable experimental expect/actual linker -Xexpect-actual-linker Enable experimental expect/actual linker
-Xexplicit-api={strict|warning|disable} -Xexplicit-api={strict|warning|disable}
Force compiler to report errors on all public API declarations without explicit visibility or return type. Force compiler to report errors on all public API declarations without explicit visibility or return type.
+2
View File
@@ -178,6 +178,8 @@ where advanced options include:
The corresponding calls' declarations may not be marked with @BuilderInference. The corresponding calls' declarations may not be marked with @BuilderInference.
-Xklib-enable-signature-clash-checks -Xklib-enable-signature-clash-checks
Enable the checks on uniqueness of signatures Enable the checks on uniqueness of signatures
-Xexpect-actual-classes The expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature.
Kotlin reports a warning every time you use them. You can use this flag to mute the warning.
-Xexpect-actual-linker Enable experimental expect/actual linker -Xexpect-actual-linker Enable experimental expect/actual linker
-Xexplicit-api={strict|warning|disable} -Xexplicit-api={strict|warning|disable}
Force compiler to report errors on all public API declarations without explicit visibility or return type. Force compiler to report errors on all public API declarations without explicit visibility or return type.
@@ -9,4 +9,10 @@ as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk! compiler or generated code. Use it at your own risk!
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
compiler/testData/cli/jvm/firMultiplatformCompilationWithoutErrors/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect interface A {
^
compiler/testData/cli/jvm/firMultiplatformCompilationWithoutErrors/jvm.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual interface A {
^
OK OK
@@ -9,4 +9,10 @@ as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk! compiler or generated code. Use it at your own risk!
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
compiler/testData/cli/jvm/firMultiplatformCompilationWithoutErrors/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect interface A {
^
compiler/testData/cli/jvm/firMultiplatformCompilationWithoutErrors/jvm.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual interface A {
^
OK OK
+12
View File
@@ -8,4 +8,16 @@ as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk! compiler or generated code. Use it at your own risk!
warning: -Xfragments flag is not supported for language version < 2.0 warning: -Xfragments flag is not supported for language version < 2.0
compiler/testData/cli/jvm/hmpp/src/a.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class A {
^
compiler/testData/cli/jvm/hmpp/src/a.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class B {
^
compiler/testData/cli/jvm/hmpp/src/b.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class A {
^
compiler/testData/cli/jvm/hmpp/src/c.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class B {
^
OK OK
@@ -8,4 +8,16 @@ as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk! compiler or generated code. Use it at your own risk!
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
compiler/testData/cli/jvm/hmpp/src/a.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class A {
^
compiler/testData/cli/jvm/hmpp/src/a.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class B {
^
compiler/testData/cli/jvm/hmpp/src/b.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class A {
^
compiler/testData/cli/jvm/hmpp/src/c.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class B {
^
OK OK
@@ -8,4 +8,16 @@ as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk! compiler or generated code. Use it at your own risk!
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
compiler/testData/cli/jvm/hmpp/src/a.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class A {
^
compiler/testData/cli/jvm/hmpp/src/a.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class B {
^
compiler/testData/cli/jvm/hmpp/src/b.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class A {
^
compiler/testData/cli/jvm/hmpp/src/c.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class B {
^
OK OK
@@ -1,2 +1,8 @@
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
compiler/testData/cli/jvm/k2SimpleMultiplatformGenericClass/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class AtomicRef<T> {
^
compiler/testData/cli/jvm/k2SimpleMultiplatformGenericClass/jvm.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class AtomicRef<T> constructor(value: T) {
^
OK OK
@@ -1 +1,4 @@
compiler/testData/cli/metadata/optionalExpectationUsage.kt:3:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect annotation class Ann()
^
OK OK
@@ -0,0 +1,49 @@
// ENABLE_EXPECT_ACTUAL_CLASSES_WARNING
// MODULE: m1-common
// FILE: common.kt
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>expect<!> class Clazz {
class <!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>Nested<!>
fun memberFun()
val memberProp: Clazz
}
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>expect<!> interface Interface
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>expect<!> object Object
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>expect<!> annotation class Annotation
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>expect<!> enum class Enum
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>expect<!> class ActualTypealias
expect fun function()
expect val property: Clazz
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> class Clazz {
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> class Nested
actual fun memberFun() {}
actual val memberProp: Clazz = null!!
}
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> interface Interface
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> object Object
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> annotation class Annotation
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> enum class Enum
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> typealias ActualTypealias = ActualTypealiasImpl
class ActualTypealiasImpl
actual fun function() {}
actual val property: Clazz = null!!
@@ -0,0 +1,49 @@
// ENABLE_EXPECT_ACTUAL_CLASSES_WARNING
// MODULE: m1-common
// FILE: common.kt
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING, EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING{JVM}!>expect<!> class Clazz {
class <!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING, EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING{JVM}!>Nested<!>
fun memberFun()
val memberProp: Clazz
}
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING, EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING{JVM}!>expect<!> interface Interface
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING, EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING{JVM}!>expect<!> object Object
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING, EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING{JVM}!>expect<!> annotation class Annotation
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING, EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING{JVM}!>expect<!> enum class Enum
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING, EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING{JVM}!>expect<!> class ActualTypealias
expect fun function()
expect val property: Clazz
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> class Clazz {
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> class Nested
actual fun memberFun() {}
actual val memberProp: Clazz = null!!
}
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> interface Interface
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> object Object
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> annotation class Annotation
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> enum class Enum
<!EXPECT_ACTUAL_CLASSIFIERS_ARE_EXPERIMENTAL_WARNING!>actual<!> typealias ActualTypealias = ActualTypealiasImpl
class ActualTypealiasImpl
actual fun function() {}
actual val property: Clazz = null!!
@@ -1,6 +1,9 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/classScopes/constructorIncorrectSignature/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo {
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,6 +1,24 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect enum class AB { A, B }
^
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/common.kt:1:24: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect enum class AB { A, B }
^
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/common.kt:1:27: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect enum class AB { A, B }
^
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/common.kt:3:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect enum class CD { C, D }
^
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/common.kt:3:24: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect enum class CD { C, D }
^
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/common.kt:3:27: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect enum class CD { C, D }
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,7 +1,25 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/classScopes/fakeOverrides/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect open class Base {
^
compiler/testData/multiplatform/classScopes/fakeOverrides/common.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Derived : Base {
^
-- JVM -- -- JVM --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/classScopes/fakeOverrides/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect open class Base {
^
compiler/testData/multiplatform/classScopes/fakeOverrides/common.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Derived : Base {
^
compiler/testData/multiplatform/classScopes/fakeOverrides/jvm.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual open class Base {
^
compiler/testData/multiplatform/classScopes/fakeOverrides/jvm.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class Derived : Base() {
^
@@ -1,6 +1,9 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/classScopes/functionAndPropertyWithSameName/common.kt:3:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo {
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,6 +1,9 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/classScopes/functionIncorrectSignature/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo {
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,6 +1,9 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/classScopes/functionIncorrectSignatureFromSuperclass/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo {
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,6 +1,9 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/classScopes/missingConstructor/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo {
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,6 +1,9 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/classScopes/missingFunction/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo {
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,8 +1,16 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/classScopes/simple/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo(param: String) {
^
-- JVM -- -- JVM --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/classScopes/simple/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo(param: String) {
^
compiler/testData/multiplatform/classScopes/simple/jvm.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class Foo actual constructor(param: String) {
^
@@ -1,7 +1,16 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/createImplClassInPlatformModule/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo
^
-- JVM -- -- JVM --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/createImplClassInPlatformModule/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo
^
compiler/testData/multiplatform/createImplClassInPlatformModule/jvm.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class Foo(x: Int) {
^
@@ -1,6 +1,9 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/defaultArguments/methodDefaultArgsViaTypealias/common.kt:3:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class A(p: String = "constructor") {
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,10 +1,37 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/defaultArguments/useDefaultArgumentsInDependency/common.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class C(x: Int, y: String = "OK")
^
compiler/testData/multiplatform/defaultArguments/useDefaultArgumentsInDependency/common.kt:7:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect annotation class Anno1(val x: Int, val y: String = "OK")
^
compiler/testData/multiplatform/defaultArguments/useDefaultArgumentsInDependency/common.kt:9:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect annotation class Anno2(val x: Int, val y: String = "OK")
^
-- JVM -- -- JVM --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/defaultArguments/useDefaultArgumentsInDependency/common.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class C(x: Int, y: String = "OK")
^
compiler/testData/multiplatform/defaultArguments/useDefaultArgumentsInDependency/common.kt:7:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect annotation class Anno1(val x: Int, val y: String = "OK")
^
compiler/testData/multiplatform/defaultArguments/useDefaultArgumentsInDependency/common.kt:9:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect annotation class Anno2(val x: Int, val y: String = "OK")
^
compiler/testData/multiplatform/defaultArguments/useDefaultArgumentsInDependency/jvm.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class C actual constructor(x: Int, y: String) {}
^
compiler/testData/multiplatform/defaultArguments/useDefaultArgumentsInDependency/jvm.kt:7:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual annotation class Anno1(actual val x: Int, actual val y: String = "OK")
^
compiler/testData/multiplatform/defaultArguments/useDefaultArgumentsInDependency/jvm.kt:9:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual annotation class Anno2(actual val x: Int, actual val y: String)
^
-- JVM (2) -- -- JVM (2) --
Exit code: OK Exit code: OK
@@ -1,7 +1,25 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/explicitActualOnOverrideOfAbstractMethod/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect abstract class Base {
^
compiler/testData/multiplatform/explicitActualOnOverrideOfAbstractMethod/common.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class DerivedImplicit : Base {
^
-- JVM -- -- JVM --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/explicitActualOnOverrideOfAbstractMethod/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect abstract class Base {
^
compiler/testData/multiplatform/explicitActualOnOverrideOfAbstractMethod/common.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class DerivedImplicit : Base {
^
compiler/testData/multiplatform/explicitActualOnOverrideOfAbstractMethod/jvm.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual abstract class Base {
^
compiler/testData/multiplatform/explicitActualOnOverrideOfAbstractMethod/jvm.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class DerivedImplicit : Base() {
^
@@ -1,6 +1,18 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/genericDeclarations/common.kt:9:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class C1<A>
^
compiler/testData/multiplatform/genericDeclarations/common.kt:10:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class C2<B : C2<B>>
^
compiler/testData/multiplatform/genericDeclarations/common.kt:11:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class C3<D, E : MutableList<in D>>
^
compiler/testData/multiplatform/genericDeclarations/common.kt:13:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect abstract class AbstractList<F> : MutableList<F>
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,6 +1,12 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/implTypeAlias/actualTypealiasToNothing/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class E01
^
compiler/testData/multiplatform/implTypeAlias/actualTypealiasToNothing/common.kt:2:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class E02
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,6 +1,12 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/implTypeAlias/actualTypealiasToNullableType/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class E01
^
compiler/testData/multiplatform/implTypeAlias/actualTypealiasToNullableType/common.kt:2:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class E02
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,10 +1,19 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/implTypeAlias/discriminateHeaderClassInFavorOfTypeAlias/common.kt:3:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class A
^
-- JVM -- -- JVM --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/implTypeAlias/discriminateHeaderClassInFavorOfTypeAlias/common.kt:3:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class A
^
compiler/testData/multiplatform/implTypeAlias/discriminateHeaderClassInFavorOfTypeAlias/jvm.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual typealias A = AImpl
^
-- JVM (2) -- -- JVM (2) --
Exit code: OK Exit code: OK
@@ -1,11 +1,19 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/implTypeAlias/generic/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class C1<A> {
^
-- JVM -- -- JVM --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/implTypeAlias/generic/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class C1<A> {
^
compiler/testData/multiplatform/implTypeAlias/generic/jvm.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual typealias C1<A> = C1Impl<A>
^
compiler/testData/multiplatform/implTypeAlias/generic/jvm.kt:3:13: warning: parameter 'a' is never used compiler/testData/multiplatform/implTypeAlias/generic/jvm.kt:3:13: warning: parameter 'a' is never used
fun foo(a: A): List<A>? = null fun foo(a: A): List<A>? = null
^ ^
@@ -1,7 +1,22 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/implTypeAlias/nestedClassesViaTypeAlias/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class ByTypeAlias {
^
compiler/testData/multiplatform/implTypeAlias/nestedClassesViaTypeAlias/common.kt:2:15: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
interface Nested
^
-- JVM -- -- JVM --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/implTypeAlias/nestedClassesViaTypeAlias/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class ByTypeAlias {
^
compiler/testData/multiplatform/implTypeAlias/nestedClassesViaTypeAlias/common.kt:2:15: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
interface Nested
^
compiler/testData/multiplatform/implTypeAlias/nestedClassesViaTypeAlias/jvm.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual typealias ByTypeAlias = ByTypeAliasImpl
^
@@ -1,6 +1,57 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/incompatibleClasses/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class PClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:2:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect interface PInterface
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:3:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect object PObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:4:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect enum class PEnumClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect annotation class PAnnotationClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:7:10: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
internal expect object InternalObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:8:8: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
public expect object PublicObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:10:6: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
open expect class OpenClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:11:10: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
abstract expect class AbstractClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:12:7: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
final expect class FinalClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:14:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class C1<A>
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:15:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class C2<B>
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:16:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class C3<D, E : D>
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:18:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class C4<F>
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:21:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect abstract class ExtendsNumber : Number
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:23:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect fun interface FunInterface {
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:27:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect fun interface FunInterface2 {
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,6 +1,42 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class O1 {
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:2:11: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
class N1
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:3:15: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
interface N2
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:4:12: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
object N3
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:7:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class O2 {
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:8:11: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
class N2
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:9:17: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
inner class I2
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:12:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class O3 {
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:13:12: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
object Companion
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:14:22: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
companion object Factory
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:17:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class O4 {
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:18:15: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
companion object
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,6 +1,9 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/incorrectImplInClass/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,9 +1,15 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/inlineClasses/common.kt:3:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect inline class Foo1(val x: Int)
^
compiler/testData/multiplatform/inlineClasses/common.kt:3:8: warning: 'inline' modifier is deprecated. Use 'value' instead compiler/testData/multiplatform/inlineClasses/common.kt:3:8: warning: 'inline' modifier is deprecated. Use 'value' instead
expect inline class Foo1(val x: Int) expect inline class Foo1(val x: Int)
^ ^
compiler/testData/multiplatform/inlineClasses/common.kt:4:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect inline class Foo2(val y: String)
^
compiler/testData/multiplatform/inlineClasses/common.kt:4:8: warning: 'inline' modifier is deprecated. Use 'value' instead compiler/testData/multiplatform/inlineClasses/common.kt:4:8: warning: 'inline' modifier is deprecated. Use 'value' instead
expect inline class Foo2(val y: String) expect inline class Foo2(val y: String)
^ ^
@@ -1,7 +1,16 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/jsNameClash/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class ClassWithImplByExtension
^
-- JS -- -- JS --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/jsNameClash/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class ClassWithImplByExtension
^
compiler/testData/multiplatform/jsNameClash/js.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class ClassWithImplByExtension
^
@@ -1,6 +1,9 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/missingOverload/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo {
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -1,11 +1,23 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/optionalExpectation/common.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect annotation class A()
^
-- JVM -- -- JVM --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/optionalExpectation/common.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect annotation class A()
^
compiler/testData/multiplatform/optionalExpectation/jvm.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual annotation class A
^
-- JS -- -- JS --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/optionalExpectation/common.kt:5:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect annotation class A()
^
@@ -1,6 +1,9 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/regressions/incompatibleClassScopesWithImplTypeAlias/common.kt:3:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect abstract class Writer protected constructor()
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
+15
View File
@@ -1,11 +1,26 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/simple/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Printer() {
^
-- JVM -- -- JVM --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/simple/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Printer() {
^
compiler/testData/multiplatform/simple/jvm.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class Printer {
^
-- JS -- -- JS --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/simple/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Printer() {
^
compiler/testData/multiplatform/simple/js.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
actual class Printer {
^
@@ -1,6 +1,9 @@
-- Common -- -- Common --
Exit code: OK Exit code: OK
Output: Output:
compiler/testData/multiplatform/weakIncompatibilityWithoutActualModifier/common.kt:1:1: warning: the expect/actual classes (including interfaces, objects, annotations, enums, actual typealiases) are an experimental feature. You can use -Xexpect-actual-classes flag to suppress this warning.
expect class Foo
^
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
@@ -23032,6 +23032,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/multiplatform/expectAbstractToString.kt"); runTest("compiler/testData/diagnostics/tests/multiplatform/expectAbstractToString.kt");
} }
@Test
@TestMetadata("expectActualClassesAreExperimentalWarning.kt")
public void testExpectActualClassesAreExperimentalWarning() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/expectActualClassesAreExperimentalWarning.kt");
}
@Test @Test
@TestMetadata("expectDataObject.kt") @TestMetadata("expectDataObject.kt")
public void testExpectDataObject() throws Exception { public void testExpectDataObject() throws Exception {
+1
View File
@@ -512,6 +512,7 @@ konanArtifacts {
extraOpts(project.globalBuildArgs) extraOpts(project.globalBuildArgs)
extraOpts( extraOpts(
"-Werror", "-Werror",
"-Xexpect-actual-classes",
"-module-name", "stdlib", "-module-name", "stdlib",
"-opt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
+1
View File
@@ -32,6 +32,7 @@ RepoArtifacts.javadocJar(project)
compileKotlin { compileKotlin {
kotlinOptions.freeCompilerArgs = [ kotlinOptions.freeCompilerArgs = [
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xexpect-actual-classes",
] ]
kotlinOptions.moduleName = project.name kotlinOptions.moduleName = project.name
} }
@@ -33,6 +33,7 @@ RepoArtifacts.javadocJar(project)
compileKotlin { compileKotlin {
kotlinOptions.freeCompilerArgs = [ kotlinOptions.freeCompilerArgs = [
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xexpect-actual-classes",
] ]
kotlinOptions.moduleName = project.name kotlinOptions.moduleName = project.name
} }
@@ -34,6 +34,7 @@ RepoArtifacts.javadocJar(project)
compileKotlin { compileKotlin {
kotlinOptions.freeCompilerArgs = [ kotlinOptions.freeCompilerArgs = [
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xexpect-actual-classes",
] ]
kotlinOptions.moduleName = project.name kotlinOptions.moduleName = project.name
} }
+3
View File
@@ -110,6 +110,7 @@ kotlin {
// providing exhaustive list of args here // providing exhaustive list of args here
freeCompilerArgs = listOf( freeCompilerArgs = listOf(
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xexpect-actual-classes",
"-Xmultifile-parts-inherit", "-Xmultifile-parts-inherit",
"-Xuse-14-inline-classes-mangling-scheme", "-Xuse-14-inline-classes-mangling-scheme",
"-Xbuiltins-from-sources", "-Xbuiltins-from-sources",
@@ -168,6 +169,7 @@ kotlin {
kotlinOptions { kotlinOptions {
freeCompilerArgs += listOf( freeCompilerArgs += listOf(
"-Xallow-kotlin-package", // TODO: maybe rename test packages "-Xallow-kotlin-package", // TODO: maybe rename test packages
"-Xexpect-actual-classes",
) )
if (kotlinBuildProperties.useFir) { if (kotlinBuildProperties.useFir) {
freeCompilerArgs += "-Xuse-k2" freeCompilerArgs += "-Xuse-k2"
@@ -256,6 +258,7 @@ kotlin {
main.apply { main.apply {
kotlinOptions { kotlinOptions {
freeCompilerArgs += "-Xir-module-name=kotlin" freeCompilerArgs += "-Xir-module-name=kotlin"
freeCompilerArgs += "-Xexpect-actual-classes"
if (!kotlinBuildProperties.disableWerror) { if (!kotlinBuildProperties.disableWerror) {
allWarningsAsErrors = true allWarningsAsErrors = true
@@ -63,6 +63,7 @@ tasks.compileKotlin {
kotlinOptions { kotlinOptions {
freeCompilerArgs += listOf( freeCompilerArgs += listOf(
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xexpect-actual-classes",
"-Xmulti-platform", "-Xmulti-platform",
"-opt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
@@ -85,6 +85,7 @@ fun Project.configureWasmKotlinTest(
tasks.withType<KotlinCompile<*>>().configureEach { tasks.withType<KotlinCompile<*>>().configureEach {
kotlinOptions.freeCompilerArgs += listOf( kotlinOptions.freeCompilerArgs += listOf(
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xexpect-actual-classes",
"-opt-in=kotlin.ExperimentalMultiplatform", "-opt-in=kotlin.ExperimentalMultiplatform",
"-opt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
"-Xwasm-target=$wasmTargetParameter" "-Xwasm-target=$wasmTargetParameter"
@@ -146,6 +146,7 @@ fun Project.configureWasmStdLib(
tasks.withType<KotlinCompile<*>>().configureEach { tasks.withType<KotlinCompile<*>>().configureEach {
kotlinOptions.freeCompilerArgs += listOf( kotlinOptions.freeCompilerArgs += listOf(
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xexpect-actual-classes",
"-opt-in=kotlin.ExperimentalMultiplatform", "-opt-in=kotlin.ExperimentalMultiplatform",
"-opt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
"-opt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",