Skip to content

Commit 20165ea

Browse files
committed
test/files/neg/t5455.scala: trait lazy val needs field
1 parent b9052da commit 20165ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,10 @@ trait MethodSynthesis {
488488
// as the symbol info is in the process of being created then.
489489
// TODO: harmonize tree & symbol creation
490490
// TODO: the `def field` call-site breaks when you add `|| vd.symbol.owner.isTrait` (detected in test suite)
491-
def noFieldFor(vd: ValDef) = vd.mods.isDeferred || (vd.mods.isLazy && isUnitType(vd.symbol.info)) || (owner.isTrait && !traitFieldFor(vd))
491+
def noFieldFor(vd: ValDef) = vd.mods.isDeferred || (vd.mods.isLazy && !owner.isTrait && isUnitType(vd.symbol.info)) || (owner.isTrait && !traitFieldFor(vd))
492492

493493
// TODO: never emit any fields in traits -- only use getter for lazy/presuper ones as well
494-
private def traitFieldFor(vd: ValDef): Boolean = vd.mods.hasFlag(PRESUPER)
494+
private def traitFieldFor(vd: ValDef): Boolean = vd.mods.hasFlag(PRESUPER | LAZY)
495495
}
496496

497497
case class Field(tree: ValDef) extends DerivedFromValDef {

0 commit comments

Comments
 (0)