[K2] Disappeared OPT_IN_USAGE_ERROR for typealias

^KT-62451
This commit is contained in:
Anastasia.Nekrasova
2023-10-12 11:45:17 +03:00
committed by Space Team
parent 54285736d0
commit 6d446abe12
3 changed files with 9 additions and 7 deletions
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.fir.references.resolved
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.resolve.toFirRegularClassSymbol
import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.scopes.impl.typeAliasForConstructor
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
@@ -191,8 +192,9 @@ object FirOptInUsageBaseChecker {
) {
val parentClassSymbol = containingClassLookupTag()?.toSymbol(context.session) as? FirRegularClassSymbol
if (this is FirConstructor) {
val ownerClassLikeSymbol = this.typeAliasForConstructor ?: parentClassSymbol
// For other callable we check dispatch receiver type instead
parentClassSymbol?.loadExperimentalities(
ownerClassLikeSymbol?.loadExperimentalities(
context, result, visited, fromSetter = false, dispatchReceiverType = null, fromSupertype = false
)
} else {
@@ -69,9 +69,9 @@ typealias YourList = ArrayList<String>
fun main() {
val x = <!OPT_IN_USAGE_ERROR!>listOf<!>(A(), B())
val y = MyList()
val z = YourList()
YourList().add("")
val y = <!OPT_IN_USAGE_ERROR!>MyList<!>()
val z = <!OPT_IN_USAGE_ERROR!>YourList<!>()
<!OPT_IN_USAGE_ERROR!>YourList<!>().add("")
}
@Marker
@@ -69,9 +69,9 @@ typealias YourList = ArrayList<String>
fun main() {
val x = <!OPT_IN_USAGE_ERROR!>listOf<!>(A(), B())
val y = MyList()
val z = YourList()
YourList().add("")
val y = <!OPT_IN_USAGE_ERROR!>MyList<!>()
val z = <!OPT_IN_USAGE_ERROR!>YourList<!>()
<!OPT_IN_USAGE_ERROR!>YourList<!>().add("")
}
@Marker