JVM_IR KT-44744 check accessibility of enum entry 'this'

This commit is contained in:
Dmitry Petrov
2021-03-15 12:52:40 +03:00
committed by TeamCityServer
parent 14cb762133
commit e630e00e99
11 changed files with 165 additions and 3 deletions
+22
View File
@@ -0,0 +1,22 @@
enum class ContentType {
PLAIN_TEXT {
override fun convert(text: String, targetType: ContentType): String {
return text
}
},
MARKDOWN {
override fun convert(text: String, targetType: ContentType): String {
return when (targetType) {
MARKDOWN -> text
PLAIN_TEXT -> ""
}
}
};
abstract fun convert(text: String, targetType: ContentType): String
}
fun box() =
ContentType.PLAIN_TEXT.convert("OK", ContentType.PLAIN_TEXT)