File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -62,8 +62,8 @@ class LazyVals extends MiniPhase with IdentityDenotTransformer {
6262 def transformLazyVal (tree : ValOrDefDef )(implicit ctx : Context ): Tree = {
6363 val sym = tree.symbol
6464 if (! (sym is Flags .Lazy ) ||
65- sym.owner.is(Flags .Trait ) ||
66- (sym.isStatic && sym.is(Flags .Module , butNot = Flags .Method )))
65+ sym.owner.is(Flags .Trait ) || // val is accessor, lazy field will be implemented in subclass
66+ (sym.isStatic && sym.is(Flags .Module , butNot = Flags .Method ))) // static module vals are implemented in the JVM by lazy loading
6767 tree
6868 else {
6969 val isField = sym.owner.isClass
Original file line number Diff line number Diff line change 1+ object Test extends App {
2+
3+ implicit def _1 : Long = 1L
4+ implicit def _2 : Int = 0
5+
6+ println(implicitly[AnyVal ])
7+ }
Original file line number Diff line number Diff line change @@ -3,9 +3,11 @@ trait T {
33}
44
55object Bar extends T
6+ object Baz extends T
67
78object Test {
89 def main (args : Array [String ]): Unit = {
9- assert(Bar .Foo == Bar .Foo ) // false
10+ assert(Bar .Foo eq Bar .Foo )
11+ assert(Bar .Foo ne Baz .Foo )
1012 }
1113}
You can’t perform that action at this time.
0 commit comments