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 : Base()
|
||||
|
||||
class GrandDerivedThird : 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()
|
||||
}
|
||||
+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()
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
@kotlin.SubclassOptInRequired(markerClass = Marker::class) public open class Base {
|
||||
public constructor Base()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@Marker public final class DerivedFirst : Base {
|
||||
public constructor DerivedFirst()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class DerivedFourth : Base {
|
||||
public constructor DerivedFourth()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.SubclassOptInRequired(markerClass = Marker::class) public final class DerivedMarked : Marked {
|
||||
public constructor DerivedMarked()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public final class DerivedSecond : Base {
|
||||
public constructor DerivedSecond()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.SubclassOptInRequired(markerClass = Marker::class) public open class DerivedThird : Base {
|
||||
public constructor DerivedThird()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class GrandDerivedFourth : DerivedFourth {
|
||||
public constructor GrandDerivedFourth()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class GrandDerivedThird : DerivedThird {
|
||||
public constructor GrandDerivedThird()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@Marker public open class Marked {
|
||||
public constructor Marked()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.RequiresOptIn public final annotation class Marker : kotlin.Annotation {
|
||||
public constructor Marker()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user