K2: drop obsolete TODO about multiple WasExperimental
In certain situations like constructor calls, it's possible to have different WasExperimental/SinceKotlin pairs associated with one use-site, e.g. a constructor call is associated both with a constructor declaration and a class declaration. However, looks like it make no sense to handle this situation in FirSinceKotlinHelpers, because FirOptInUsageBaseChecker already handles them. #KT-59825 Fixed
This commit is contained in:
committed by
Space Team
parent
4d49bdb8ca
commit
a2dc4f155f
+6
@@ -43118,6 +43118,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("wasExperimentalCombined.kt")
|
||||
public void testWasExperimentalCombined() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimentalCombined.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("wrongTargetsWithoutExplicitTarget.kt")
|
||||
public void testWrongTargetsWithoutExplicitTarget() throws Exception {
|
||||
|
||||
+6
@@ -43118,6 +43118,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("wasExperimentalCombined.kt")
|
||||
public void testWasExperimentalCombined() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimentalCombined.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("wrongTargetsWithoutExplicitTarget.kt")
|
||||
public void testWrongTargetsWithoutExplicitTarget() throws Exception {
|
||||
|
||||
+6
@@ -40998,6 +40998,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("wasExperimentalCombined.kt")
|
||||
public void testWasExperimentalCombined() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimentalCombined.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("wrongTargetsWithoutExplicitTarget.kt")
|
||||
public void testWrongTargetsWithoutExplicitTarget() throws Exception {
|
||||
|
||||
+6
@@ -41118,6 +41118,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("wasExperimentalCombined.kt")
|
||||
public void testWasExperimentalCombined() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimentalCombined.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("wrongTargetsWithoutExplicitTarget.kt")
|
||||
public void testWrongTargetsWithoutExplicitTarget() throws Exception {
|
||||
|
||||
-1
@@ -68,7 +68,6 @@ private fun FirDeclaration.getOwnSinceKotlinVersion(session: FirSession): FirSin
|
||||
)
|
||||
val apiVersion = ((sinceKotlinSingleArgument as? FirConstExpression<*>)?.value as? String)?.let(ApiVersion.Companion::parse)
|
||||
if (apiVersion != null) {
|
||||
// TODO, KT-59825: combine wasExperimentalMarkerClasses in case of several associated declarations with the same maximal API version
|
||||
if (result == null || apiVersion > result!!.apiVersion) {
|
||||
result = FirSinceKotlinValue(apiVersion, loadWasExperimentalMarkerClasses(session))
|
||||
}
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
// API_VERSION: 1.8
|
||||
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ClassMarker
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ConstructorMarker
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class TypeAliasMarker
|
||||
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ClassMarker::class)
|
||||
class C {
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ConstructorMarker::class)
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(TypeAliasMarker::class)
|
||||
typealias T = <!OPT_IN_USAGE_ERROR!>C<!>
|
||||
|
||||
@ClassMarker
|
||||
fun test1() {
|
||||
<!OPT_IN_USAGE_ERROR!>C<!>()
|
||||
}
|
||||
|
||||
@ConstructorMarker
|
||||
fun test2() {
|
||||
<!OPT_IN_USAGE_ERROR!>C<!>()
|
||||
}
|
||||
|
||||
@ClassMarker
|
||||
@ConstructorMarker
|
||||
fun test3() {
|
||||
C()
|
||||
}
|
||||
|
||||
@ClassMarker
|
||||
fun test4(t: <!OPT_IN_USAGE_ERROR!>T<!>) {}
|
||||
|
||||
@TypeAliasMarker
|
||||
fun test5(t: <!OPT_IN_USAGE_ERROR!>T<!>) {}
|
||||
|
||||
@ClassMarker
|
||||
@TypeAliasMarker
|
||||
fun test6(t: T) {}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
// API_VERSION: 1.8
|
||||
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ClassMarker
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ConstructorMarker
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class TypeAliasMarker
|
||||
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ClassMarker::class)
|
||||
class C {
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ConstructorMarker::class)
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(TypeAliasMarker::class)
|
||||
typealias T = <!OPT_IN_USAGE_ERROR!>C<!>
|
||||
|
||||
@ClassMarker
|
||||
fun test1() {
|
||||
<!UNRESOLVED_REFERENCE!>C<!>()
|
||||
}
|
||||
|
||||
@ConstructorMarker
|
||||
fun test2() {
|
||||
<!OPT_IN_USAGE_ERROR!>C<!>()
|
||||
}
|
||||
|
||||
@ClassMarker
|
||||
@ConstructorMarker
|
||||
fun test3() {
|
||||
C()
|
||||
}
|
||||
|
||||
@ClassMarker
|
||||
fun test4(t: <!OPT_IN_USAGE_ERROR!>T<!>) {}
|
||||
|
||||
@TypeAliasMarker
|
||||
fun test5(t: <!OPT_IN_USAGE_ERROR!>T<!>) {}
|
||||
|
||||
@ClassMarker
|
||||
@TypeAliasMarker
|
||||
fun test6(t: T) {}
|
||||
Generated
+6
@@ -43112,6 +43112,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("wasExperimentalCombined.kt")
|
||||
public void testWasExperimentalCombined() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimentalCombined.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("wrongTargetsWithoutExplicitTarget.kt")
|
||||
public void testWrongTargetsWithoutExplicitTarget() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user