Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimentalCombined.kt
T
Mikhail Glukhikh a2dc4f155f 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
2023-11-15 09:36:06 +00:00

53 lines
964 B
Kotlin
Vendored

// 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) {}