diff --git a/compiler/src/dotty/tools/dotc/transform/LazyVals.scala b/compiler/src/dotty/tools/dotc/transform/LazyVals.scala index 0f930b353e36..77fc11d25ab0 100644 --- a/compiler/src/dotty/tools/dotc/transform/LazyVals.scala +++ b/compiler/src/dotty/tools/dotc/transform/LazyVals.scala @@ -36,7 +36,7 @@ class LazyVals extends MiniPhase with IdentityDenotTransformer { class OffsetInfo(var defs: List[Tree], var ord:Int) val appendOffsetDefs = mutable.Map.empty[Symbol, OffsetInfo] - override def phaseName: String = "LazyVals" + override def phaseName: String = "lazyVals" /** List of names of phases that should have finished processing of tree * before this phase starts processing same tree */ @@ -61,7 +61,10 @@ class LazyVals extends MiniPhase with IdentityDenotTransformer { def transformLazyVal(tree: ValOrDefDef)(implicit ctx: Context): Tree = { val sym = tree.symbol - if (!(sym is Flags.Lazy) || sym.owner.is(Flags.Trait) || (sym.isStatic && sym.is(Flags.Module))) tree + if (!(sym is Flags.Lazy) || + sym.owner.is(Flags.Trait) || // val is accessor, lazy field will be implemented in subclass + (sym.isStatic && sym.is(Flags.Module, butNot = Flags.Method))) // static module vals are implemented in the JVM by lazy loading + tree else { val isField = sym.owner.isClass if (isField) { diff --git a/tests/pending/run/implicits-numeric.scala b/tests/pending/run/implicits-numeric.scala new file mode 100644 index 000000000000..dfb0ff46082a --- /dev/null +++ b/tests/pending/run/implicits-numeric.scala @@ -0,0 +1,7 @@ +object Test extends App { + + implicit def _1: Long = 1L + implicit def _2: Int = 0 + + println(implicitly[AnyVal]) +} diff --git a/tests/run/i3624.scala b/tests/run/i3624.scala new file mode 100644 index 000000000000..b9d20d05a4b0 --- /dev/null +++ b/tests/run/i3624.scala @@ -0,0 +1,13 @@ +trait T { + case object Foo +} + +object Bar extends T +object Baz extends T + +object Test { + def main(args: Array[String]): Unit = { + assert(Bar.Foo eq Bar.Foo) + assert(Bar.Foo ne Baz.Foo) + } +}