@@ -66,8 +66,8 @@ abstract class ChannelLincheckTestBase(
66
66
fun trySend (@Param(name = " value" ) value : Int ): Any = c.trySend(value)
67
67
.onSuccess { return true }
68
68
.onFailure {
69
- if (it is NumberedCancellationException ) return it.testResult
70
- else throw it !!
69
+ return if (it is NumberedCancellationException ) it.testResult
70
+ else false
71
71
}
72
72
73
73
// TODO: this operation should be (and can be!) linearizable, but is not
@@ -85,11 +85,11 @@ abstract class ChannelLincheckTestBase(
85
85
e.testResult
86
86
}
87
87
88
- @Operation
88
+ // @Operation TODO Lincheck doesn't work with inline classes
89
89
fun tryReceive (): Any? =
90
90
c.tryReceive()
91
- .onSuccess { it }
92
- .onFailure { if (it is NumberedCancellationException ) it.testResult else throw it !! }
91
+ .onSuccess { return it }
92
+ .onFailure { return if (it is NumberedCancellationException ) it.testResult else null }
93
93
94
94
// TODO: this operation should be (and can be!) linearizable, but is not
95
95
// @Operation
@@ -131,15 +131,15 @@ abstract class SequentialIntChannelBase(private val capacity: Int) : VerifierSta
131
131
private val buffer = ArrayList <Int >()
132
132
private var closedMessage: String? = null
133
133
134
- suspend fun send (x : Int ): Any = when (val offerRes = offer (x)) {
134
+ suspend fun send (x : Int ): Any = when (val offerRes = trySend (x)) {
135
135
true -> Unit
136
136
false -> suspendCancellableCoroutine { cont ->
137
137
senders.add(cont to x)
138
138
}
139
139
else -> offerRes
140
140
}
141
141
142
- fun offer (element : Int ): Any {
142
+ fun trySend (element : Int ): Any {
143
143
if (closedMessage != = null ) return closedMessage!!
144
144
if (capacity == CONFLATED ) {
145
145
if (resumeFirstReceiver(element)) return true
0 commit comments