K1 opt-in: fix message/behavior for future error with WasExperimental

This commit is contained in:
Mikhail Glukhikh
2022-11-22 08:30:39 +01:00
committed by Space Team
parent 8ddc535caf
commit f62bdb0e3d
8 changed files with 68 additions and 2 deletions
@@ -37886,6 +37886,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.kt");
}
@Test
@TestMetadata("duration.kt")
public void testDuration() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/duration.kt");
}
@Test
@TestMetadata("errors.kt")
public void testErrors() throws Exception {
@@ -37886,6 +37886,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.kt");
}
@Test
@TestMetadata("duration.kt")
public void testDuration() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/duration.kt");
}
@Test
@TestMetadata("errors.kt")
public void testErrors() throws Exception {
@@ -37886,6 +37886,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.kt");
}
@Test
@TestMetadata("duration.kt")
public void testDuration() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/duration.kt");
}
@Test
@TestMetadata("errors.kt")
public void testErrors() throws Exception {
@@ -143,7 +143,7 @@ class OptInUsageChecker(project: Project) : CallChecker {
),
futureError = OptInFactoryBasedReporter(
Errors.OPT_IN_USAGE_FUTURE_ERROR,
getDefaultDiagnosticMessage("This declaration is experimental due to signature types and its usage must be marked (will become an error in 1.6)")
getDefaultDiagnosticMessage("This declaration is experimental due to signature types and its usage must be marked (will become an error in future releases)")
),
)
@@ -243,7 +243,7 @@ class OptInUsageChecker(project: Project) : CallChecker {
if (annotations.any { it.fqName == WAS_EXPERIMENTAL_FQ_NAME }) {
val accessibility = checkSinceKotlinVersionAccessibility(languageVersionSettings)
if (accessibility is SinceKotlinAccessibility.NotAccessibleButWasExperimental) {
result.addAll(accessibility.markerClasses.mapNotNull { it.loadOptInForMarkerAnnotation() })
result.addAll(accessibility.markerClasses.mapNotNull { it.loadOptInForMarkerAnnotation(useFutureError) })
}
}
@@ -0,0 +1,14 @@
// !API_VERSION: 1.5
import kotlin.time.Duration
@OptIn(kotlin.time.ExperimentalTime::class)
data class Some(val duration: Duration = Duration.INFINITE)
@OptIn(kotlin.time.ExperimentalTime::class)
fun foo(duration: Duration = Duration.INFINITE) {}
fun test() {
Some()
foo()
}
@@ -0,0 +1,14 @@
// !API_VERSION: 1.5
import kotlin.time.Duration
@OptIn(kotlin.time.ExperimentalTime::class)
data class Some(val duration: Duration = Duration.INFINITE)
@OptIn(kotlin.time.ExperimentalTime::class)
fun foo(duration: Duration = Duration.INFINITE) {}
fun test() {
<!OPT_IN_USAGE_FUTURE_ERROR!>Some<!>()
<!OPT_IN_USAGE_ERROR!>foo<!>()
}
@@ -0,0 +1,14 @@
package
@kotlin.OptIn(markerClass = {kotlin.time.ExperimentalTime::class}) public fun foo(/*0*/ duration: kotlin.time.Duration = ...): kotlin.Unit
public fun test(): kotlin.Unit
@kotlin.OptIn(markerClass = {kotlin.time.ExperimentalTime::class}) public final data class Some {
public constructor Some(/*0*/ duration: kotlin.time.Duration = ...)
public final val duration: kotlin.time.Duration
public final operator /*synthesized*/ fun component1(): kotlin.time.Duration
public final /*synthesized*/ fun copy(/*0*/ duration: kotlin.time.Duration = ...): Some
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
}
@@ -37976,6 +37976,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.kt");
}
@Test
@TestMetadata("duration.kt")
public void testDuration() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/duration.kt");
}
@Test
@TestMetadata("errors.kt")
public void testErrors() throws Exception {