[K2] Violation of OPT_IN_USAGE_ERROR non-propagating opt-in rules for typealias
^KT-62451
This commit is contained in:
committed by
Space Team
parent
6d446abe12
commit
4c9ad970ff
+3
-4
@@ -208,6 +208,7 @@ object FirOptInUsageBaseChecker {
|
||||
it.returnTypeRef.coneType.addExperimentalities(context, result, visited)
|
||||
}
|
||||
}
|
||||
|
||||
if (fromSetter && symbol is FirPropertySymbol) {
|
||||
symbol.setterSymbol?.loadExperimentalities(
|
||||
context, result, visited, fromSetter = false, dispatchReceiverType, fromSupertype = false
|
||||
@@ -228,10 +229,8 @@ object FirOptInUsageBaseChecker {
|
||||
context, result, visited, fromSetter = false, dispatchReceiverType = null, fromSupertype = false
|
||||
)
|
||||
}
|
||||
is FirTypeAlias -> {
|
||||
expandedTypeRef.coneType.addExperimentalities(context, result, visited)
|
||||
}
|
||||
is FirAnonymousObject -> {
|
||||
|
||||
is FirAnonymousObject, is FirTypeAlias -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -32,7 +32,7 @@ fun useDataClass(d: DataClass) {
|
||||
|
||||
typealias My = <!OPT_IN_USAGE_ERROR!>Some<!>
|
||||
|
||||
fun my(my: <!OPT_IN_USAGE_ERROR!>My<!>) {}
|
||||
fun my(my: My) {}
|
||||
|
||||
fun your(my: <!OPT_IN_USAGE_ERROR!>Some<!>) {}
|
||||
|
||||
@@ -64,12 +64,16 @@ class B : I
|
||||
@OptIn(Marker::class)
|
||||
typealias MyList = ArrayList<I>
|
||||
|
||||
@Marker
|
||||
typealias AList = ArrayList<I>
|
||||
|
||||
@Marker
|
||||
typealias YourList = ArrayList<String>
|
||||
|
||||
fun main() {
|
||||
val x = <!OPT_IN_USAGE_ERROR!>listOf<!>(A(), B())
|
||||
val y = <!OPT_IN_USAGE_ERROR!>MyList<!>()
|
||||
val y = MyList()
|
||||
val b = <!OPT_IN_USAGE_ERROR!>AList<!>()
|
||||
val z = <!OPT_IN_USAGE_ERROR!>YourList<!>()
|
||||
<!OPT_IN_USAGE_ERROR!>YourList<!>().add("")
|
||||
}
|
||||
|
||||
@@ -64,12 +64,16 @@ class B : I
|
||||
@OptIn(Marker::class)
|
||||
typealias MyList = ArrayList<I>
|
||||
|
||||
@Marker
|
||||
typealias AList = ArrayList<I>
|
||||
|
||||
@Marker
|
||||
typealias YourList = ArrayList<String>
|
||||
|
||||
fun main() {
|
||||
val x = <!OPT_IN_USAGE_ERROR!>listOf<!>(A(), B())
|
||||
val y = <!OPT_IN_USAGE_ERROR!>MyList<!>()
|
||||
val b = <!OPT_IN_USAGE_ERROR!>AList<!>()
|
||||
val z = <!OPT_IN_USAGE_ERROR!>YourList<!>()
|
||||
<!OPT_IN_USAGE_ERROR!>YourList<!>().add("")
|
||||
}
|
||||
|
||||
@@ -111,6 +111,7 @@ public abstract class User {
|
||||
public final fun withSome(/*0*/ some: Some? = ...): kotlin.Unit
|
||||
public final fun Some?.onSome(): kotlin.Unit
|
||||
}
|
||||
@Marker public typealias AList = kotlin.collections.ArrayList<I>
|
||||
public typealias My = Some
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public typealias MyList = kotlin.collections.ArrayList<I>
|
||||
@Marker public typealias YourList = kotlin.collections.ArrayList<kotlin.String>
|
||||
|
||||
+6
-2
@@ -32,7 +32,7 @@ fun useDataClass(d: DataClass) {
|
||||
|
||||
typealias My = <!OPT_IN_USAGE_ERROR!>Some<!>
|
||||
|
||||
fun my(my: <!OPT_IN_USAGE_ERROR!>My<!>) {}
|
||||
fun my(my: My) {}
|
||||
|
||||
fun your(my: <!OPT_IN_USAGE_ERROR!>Some<!>) {}
|
||||
|
||||
@@ -64,12 +64,16 @@ class B : I
|
||||
@OptIn(Marker::class)
|
||||
typealias MyList = ArrayList<I>
|
||||
|
||||
@Marker
|
||||
typealias AList = ArrayList<I>
|
||||
|
||||
@Marker
|
||||
typealias YourList = ArrayList<String>
|
||||
|
||||
fun main() {
|
||||
val x = <!OPT_IN_USAGE_ERROR!>listOf<!>(A(), B())
|
||||
val y = <!OPT_IN_USAGE_ERROR!>MyList<!>()
|
||||
val y = MyList()
|
||||
val b = <!OPT_IN_USAGE_ERROR!>AList<!>()
|
||||
val z = <!OPT_IN_USAGE_ERROR!>YourList<!>()
|
||||
<!OPT_IN_USAGE_ERROR!>YourList<!>().add("")
|
||||
}
|
||||
|
||||
+4
@@ -64,12 +64,16 @@ class B : I
|
||||
@OptIn(Marker::class)
|
||||
typealias MyList = ArrayList<I>
|
||||
|
||||
@Marker
|
||||
typealias AList = ArrayList<I>
|
||||
|
||||
@Marker
|
||||
typealias YourList = ArrayList<String>
|
||||
|
||||
fun main() {
|
||||
val x = <!OPT_IN_USAGE_FUTURE_ERROR!>listOf<!>(A(), B())
|
||||
val y = <!OPT_IN_USAGE_FUTURE_ERROR!>MyList<!>()
|
||||
val b = <!OPT_IN_USAGE_FUTURE_ERROR!>AList<!>()
|
||||
val z = <!OPT_IN_USAGE_FUTURE_ERROR!>YourList<!>()
|
||||
<!OPT_IN_USAGE_FUTURE_ERROR!>YourList<!>().add("")
|
||||
}
|
||||
|
||||
+2
@@ -111,6 +111,8 @@ public abstract class User {
|
||||
public final fun withSome(/*0*/ some: Some? = ...): kotlin.Unit
|
||||
public final fun Some?.onSome(): kotlin.Unit
|
||||
}
|
||||
@Marker public typealias AList = kotlin.collections.ArrayList<I>
|
||||
public typealias My = Some
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public typealias MyList = kotlin.collections.ArrayList<I>
|
||||
@Marker public typealias YourList = kotlin.collections.ArrayList<kotlin.String>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user