[tests] Add new (and refactor existing) tests for @SubclassOptInRequired
KT-54617
This commit is contained in:
committed by
Space Team
parent
833edfb209
commit
e6d5df18b8
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class ApiMarker
|
||||
|
||||
@SubclassOptInRequired(ApiMarker::class)
|
||||
interface InterfaceOptInApi
|
||||
|
||||
// no opt-in: diagnostic reported
|
||||
interface InterfaceOptInApiInheritorA: <!OPT_IN_USAGE_ERROR!>InterfaceOptInApi<!>
|
||||
|
||||
// opt-in present: no diagnostic, opt-in isn't propagated
|
||||
@OptIn(ApiMarker::class)
|
||||
interface InterfaceOptInApiInheritorB: InterfaceOptInApi
|
||||
|
||||
// inheritance opt-in required: no diagnostic, opt-in is propagated
|
||||
@SubclassOptInRequired(ApiMarker::class)
|
||||
interface InterfaceOptInApiInheritorC: InterfaceOptInApi
|
||||
|
||||
// full opt-in required: no diagnostic, stricter opt-in is propagated
|
||||
@ApiMarker
|
||||
interface InterfaceOptInApiInheritorD: InterfaceOptInApi
|
||||
|
||||
interface InterfaceOptInApiInheritorE: InterfaceOptInApiInheritorB // inheritance opt-in isn't propagated
|
||||
interface InterfaceOptInApiInheritorF: <!OPT_IN_USAGE_ERROR!>InterfaceOptInApiInheritorC<!> // inheritance opt-in is propagated
|
||||
interface InterfaceOptInApiInheritorG: <!OPT_IN_USAGE_ERROR!>InterfaceOptInApiInheritorD<!> // inheritance opt-in is propagated
|
||||
|
||||
fun useSiteTestInterfaces(
|
||||
o: InterfaceOptInApi, // usage opt-in isn't required
|
||||
b: InterfaceOptInApiInheritorB, // usage opt-in isn't required
|
||||
c: InterfaceOptInApiInheritorC, // usage opt-in isn't required
|
||||
d: <!OPT_IN_USAGE_ERROR!>InterfaceOptInApiInheritorD<!>, // usage opt-in is required
|
||||
e: InterfaceOptInApiInheritorE // usage opt-in isn't required
|
||||
) {}
|
||||
Reference in New Issue
Block a user