K1: report errors related to SubClassOptInRequired annotation
Related to KT-41886
This commit is contained in:
committed by
teamcity
parent
84291181af
commit
c67c5cad27
+35
@@ -0,0 +1,35 @@
|
||||
@RequiresOptIn
|
||||
annotation class Marker
|
||||
|
||||
@SubclassOptInRequired(Marker::class)
|
||||
open class Base
|
||||
|
||||
@Marker
|
||||
class DerivedFirst : Base()
|
||||
|
||||
@OptIn(Marker::class)
|
||||
class DerivedSecond : Base()
|
||||
|
||||
@SubclassOptInRequired(Marker::class)
|
||||
open class DerivedThird : Base()
|
||||
|
||||
open class DerivedFourth : <!OPT_IN_USAGE_ERROR!>Base<!>()
|
||||
|
||||
class GrandDerivedThird : <!OPT_IN_USAGE_ERROR!>DerivedThird<!>()
|
||||
|
||||
// Question: should we have an error also here?
|
||||
class GrandDerivedFourth : DerivedFourth()
|
||||
|
||||
@Marker
|
||||
open class Marked
|
||||
|
||||
@SubclassOptInRequired(Marker::class)
|
||||
class DerivedMarked : <!OPT_IN_USAGE_ERROR!>Marked<!>()
|
||||
|
||||
fun test() {
|
||||
val b = Base()
|
||||
val d1 = <!OPT_IN_USAGE_ERROR!>DerivedFirst<!>()
|
||||
val d2 = DerivedSecond()
|
||||
val d3 = DerivedThird()
|
||||
val d4 = DerivedFourth()
|
||||
}
|
||||
Reference in New Issue
Block a user