Fix 'equals' for NotNullBasicValue
NotNullBasicValues were merged incorrectly sometimes, which caused problems with INSTANCEOF checks. #KT-18779 Fixed
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
sealed class Result {
|
||||
class Failure(val exception: Exception) : Result()
|
||||
class Success(val message: String) : Result()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result: Result
|
||||
try {
|
||||
result = Result.Success("OK")
|
||||
}
|
||||
catch (e: Exception) {
|
||||
result = Result.Failure(Exception())
|
||||
}
|
||||
|
||||
when (result) {
|
||||
is Result.Failure -> throw result.exception
|
||||
is Result.Success -> return result.message
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user