kotlin {
compilerOptions {
freeCompilerArgs.add("-Xwhen-guards")
}
}
< /code>
Но когда я использую «когда охранники» вроде этого < /p>
fun processNotification(notification: Notification) {
when (notification) {
is Notification.Email if notification.isHighPriority -> println("Send high-priority email")
is Notification.Email -> println("Send regular email")
is Notification.SMS if notification.isInternational -> println("Send international SMS")
is Notification.SMS -> println("Send local SMS")
else -> println("Unknown notification type")
}
}
< /code>
Android Studio по -прежнему показывает эту ошибку < /p>
The feature "when guards" is experimental and should be enabled explicitly
Я уже обновил свой проект Android, чтобы использовать Kotlin 2.1.0. p> [code]kotlin { compilerOptions { freeCompilerArgs.add("-Xwhen-guards") } } < /code> Но когда я использую «когда охранники» вроде этого < /p> fun processNotification(notification: Notification) { when (notification) { is Notification.Email if notification.isHighPriority -> println("Send high-priority email") is Notification.Email -> println("Send regular email") is Notification.SMS if notification.isInternational -> println("Send international SMS") is Notification.SMS -> println("Send local SMS") else -> println("Unknown notification type") } } < /code> Android Studio по -прежнему показывает эту ошибку < /p> The feature "when guards" is experimental and should be enabled explicitly [/code] Я пропустил что -то важное? 2024.2.2 Патч 1