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