File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ sealed abstract class OrderType (val reverse : OrderType )
2
+ case object Buy extends OrderType (Sell ) // error
3
+ case object Sell extends OrderType (Buy ) // error
Original file line number Diff line number Diff line change
1
+ object DeadLockTest {
2
+ def main (args : Array [String ]): Unit = {
3
+ def run (block : => Unit ): Unit =
4
+ new Thread (new Runnable {def run (): Unit = block}).start()
5
+
6
+ run {println(Parent .Child1 )}
7
+ run {println(Parent .Child2 )}
8
+
9
+ }
10
+
11
+ object Parent { // error
12
+ trait Child {
13
+ Thread .sleep(2000 ) // ensure concurrent behavior
14
+ val parent = Parent
15
+ def siblings = parent.children - this
16
+ }
17
+
18
+ object Child1 extends Child // error
19
+ object Child2 extends Child // error
20
+
21
+ final val children = Set (Child1 , Child2 ) // error
22
+ }
23
+ }
You can’t perform that action at this time.
0 commit comments