-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AllowExtraSuspension parameter deprecated, SUSPENDED prefix removed from the output #339
Conversation
2. SUSPENDED prefix removed from the output
src/jvm/test/org/jetbrains/kotlinx/lincheck_test/verifier/AllowExtraSuspensionTest.kt
Show resolved
Hide resolved
} | ||
|
||
private fun kotlin.Result<Any?>.toLinCheckResult(wasSuspended: Boolean) = | ||
if (isSuccess) { | ||
when (val value = getOrNull()) { | ||
is Unit -> if (wasSuspended) SuspendedVoidResult else VoidResult | ||
// Throwable was returned as a successful result | ||
is Throwable -> ValueResult(value::class.java, wasSuspended) | ||
else -> ValueResult(value, wasSuspended) | ||
is Throwable -> ValueResult(value::class.java) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be ExceptionResult?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is a case when Throwable was returned as a successful result, see comment above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should you extract a class in one case and a value in another? ExceptionResult
should be a successful one as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the current code is (and was) buggy here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I agree, let's treat this case as a regular one, creating ValueResult(value)
here.
} | ||
|
||
private fun kotlin.Result<Any?>.toLinCheckResult(wasSuspended: Boolean) = | ||
if (isSuccess) { | ||
when (val value = getOrNull()) { | ||
is Unit -> if (wasSuspended) SuspendedVoidResult else VoidResult | ||
// Throwable was returned as a successful result | ||
is Throwable -> ValueResult(value::class.java, wasSuspended) | ||
else -> ValueResult(value, wasSuspended) | ||
is Throwable -> ValueResult(value::class.java) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the current code is (and was) buggy here.
Closes #319