@@ -175,12 +175,31 @@ class BasicTests extends TestSuite {
175
175
assertCompletes(prg)
176
176
}
177
177
178
- test(" coDistribute" ) {
178
+ {
179
+ // temporarily moved outside the next `test` body due to https://github.com/lampepfl/dotty/issues/12508
180
+
179
181
type B = Val [Boolean ]
180
182
type C = Val [Char ]
181
183
type I = Val [Int ]
182
184
type S = Val [String ]
183
185
186
+ case class Combination [X , Y ](
187
+ choose1 : (B |&| C ) -⚬ Val [X ],
188
+ choose2 : (I |&| S ) -⚬ Val [Y ],
189
+ expectedX : X ,
190
+ expectedY : Y ,
191
+ ) {
192
+ type T = X
193
+ type U = Y
194
+
195
+ def go : ((B |&| C ) |*| (I |&| S )) -⚬ Val [(T , U )] =
196
+ par(choose1, choose2) > unliftPair
197
+
198
+ def expected : (T , U ) =
199
+ (expectedX, expectedY)
200
+ }
201
+
202
+ test(" coDistribute" ) {
184
203
// (false 1) (true "foo") ('a' 2) ('b' "bar")
185
204
val init : Done -⚬ (((B |*| I ) |&| (B |*| S )) |&| ((C |*| I ) |&| (C |*| S ))) =
186
205
choice(
@@ -205,22 +224,6 @@ class BasicTests extends TestSuite {
205
224
.bimap(coDistributeR, coDistributeR) .to[ ((B |&| C ) |*| I ) |&| ((B |&| C ) |*| S ) ]
206
225
.> (coDistributeL) .to[ (B |&| C ) |*| (I |&| S ) ]
207
226
208
- case class Combination [X , Y ](
209
- choose1 : (B |&| C ) -⚬ Val [X ],
210
- choose2 : (I |&| S ) -⚬ Val [Y ],
211
- expectedX : X ,
212
- expectedY : Y ,
213
- ) {
214
- type T = X
215
- type U = Y
216
-
217
- def go : ((B |&| C ) |*| (I |&| S )) -⚬ Val [(T , U )] =
218
- par(choose1, choose2) > unliftPair
219
-
220
- def expected : (T , U ) =
221
- (expectedX, expectedY)
222
- }
223
-
224
227
val combinations = Seq (
225
228
Combination (chooseL, chooseL, false , 1 ),
226
229
Combination (chooseL, chooseR, true , " foo" ),
@@ -235,6 +238,7 @@ class BasicTests extends TestSuite {
235
238
assertVal(f > c.go, c.expected)
236
239
}
237
240
}
241
+ }
238
242
239
243
test(" LList.splitEvenOdd" ) {
240
244
val prg : Done -⚬ Val [(List [Int ], List [Int ])] =
@@ -254,14 +258,16 @@ class BasicTests extends TestSuite {
254
258
assertVal(prg, List ((1 , 2 ), (3 , 4 ), (5 , 0 )))
255
259
}
256
260
257
- test(" acquire - effect - transform - release" ) {
261
+ {
262
+ // temporarily moved outside the next `test` body due to https://github.com/lampepfl/dotty/issues/12508
258
263
class MVar [A ](var value : A ) {
259
264
def set (a : A ): MVar [A ] = {
260
265
this .value = a
261
266
this
262
267
}
263
268
}
264
269
270
+ test(" acquire - effect - transform - release" ) {
265
271
val acquireFuns = Seq [Val [Int ] -⚬ Res [MVar [Int ]]](
266
272
mVal(new MVar (_)),
267
273
acquire0(new MVar (_), release = None ),
@@ -304,6 +310,7 @@ class BasicTests extends TestSuite {
304
310
assertVal(prg, " 1" )
305
311
}
306
312
}
313
+ }
307
314
308
315
test(" release via registered function" ) {
309
316
val ref = new java.util.concurrent.atomic.AtomicReference [String ](" init" )
0 commit comments