Fix 'equals' for NotNullBasicValue

NotNullBasicValues were merged incorrectly sometimes,
which caused problems with INSTANCEOF checks.

 #KT-18779 Fixed
This commit is contained in:
Dmitry Petrov
2017-07-03 14:08:15 +03:00
parent 8121c1d3c4
commit 16505daeea
6 changed files with 44 additions and 1 deletions
+19
View File
@@ -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
}
}