File tree 2 files changed +33
-0
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -194,6 +194,10 @@ object LiftCoverage extends LiftImpure {
194
194
val liftedArgs = liftArgs(defs, tree.fun.tpe, tree.args)(using liftingArgsContext)
195
195
tpd.cpy.Apply (tree)(liftedFun, liftedArgs)
196
196
}
197
+
198
+ override def liftedFlags : FlagSet = Method
199
+
200
+ override def liftedDef (sym : TermSymbol , rhs : tpd.Tree )(using Context ): tpd.DefDef = tpd.DefDef (sym, rhs)
197
201
}
198
202
199
203
object LiftErased extends LiftComplex :
Original file line number Diff line number Diff line change
1
+ // scalac: -coverage-out:coverage
2
+
3
+ import concurrent .ExecutionContext .Implicits .global
4
+ import scala .concurrent .*
5
+ import scala .concurrent .duration .*
6
+
7
+ var test = 0
8
+
9
+ def brokenSynchronizedBlock (option : Boolean ): Future [Unit ] = Future {
10
+ if (option) {
11
+ Thread .sleep(500 )
12
+ }
13
+ synchronized {
14
+ val tmp = test
15
+ Thread .sleep(1000 )
16
+ test = tmp + 1
17
+ }
18
+ }
19
+
20
+ object Test extends App {
21
+ Await .result(
22
+ Future .sequence(Seq (brokenSynchronizedBlock(false ), brokenSynchronizedBlock(true )))
23
+ .map { result =>
24
+ println(test)
25
+ assert(test == 2 )
26
+ },
27
+ 3 .seconds
28
+ )
29
+ }
You can’t perform that action at this time.
0 commit comments