File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,10 @@ import Symbols._
11
11
import Decorators ._
12
12
import NameOps ._
13
13
import StdNames .nme
14
+ import rewrite .Rewrites .patch
15
+ import util .Positions .Position
14
16
import dotty .tools .dotc .transform .TreeTransforms .{TransformerInfo , TreeTransformer , MiniPhaseTransform }
17
+ import dotty .tools .dotc .ast .NavigateAST ._
15
18
import dotty .tools .dotc .ast .Trees ._
16
19
import dotty .tools .dotc .ast .{untpd , tpd }
17
20
import dotty .tools .dotc .core .Constants .Constant
@@ -64,11 +67,14 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer with Nee
64
67
val sym = tree.symbol
65
68
if (! (sym is Flags .Lazy ) || sym.owner.is(Flags .Trait ) || (sym.isStatic && sym.is(Flags .Module ))) tree
66
69
else {
67
-
68
70
val isField = sym.owner.isClass
69
-
70
71
if (isField) {
71
72
if (sym.isVolatile ||
73
+ ctx.scala2Mode && {
74
+ if (ctx.settings.rewrite.value.isDefined)
75
+ patch(ctx.compilationUnit.source, Position (toUntyped(tree).envelope.start), " @volatile " )
76
+ true // cannot assume volatile because of problems with compilestdlib. See #1149
77
+ } ||
72
78
(sym.is(Flags .Module ) && ! sym.is(Flags .Synthetic )))
73
79
// module class is user-defined.
74
80
// Should be threadsafe, to mimic safety guaranteed by global object
You can’t perform that action at this time.
0 commit comments