Skip to content

Make LazyVals implement non-static modules. Move LV after erasure. #493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
Apr 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
b1ce9c2
Mixin: needs to call transformFollowing to make memoize run on traitI…
DarkDimius Apr 22, 2015
e1c482a
Make Memoize not depend on prepareForDefDef.
DarkDimius Apr 23, 2015
b50d209
Make Constructors change owners.
DarkDimius Apr 23, 2015
de67c05
Allow FutureDefs in changeOwner
odersky Apr 23, 2015
ebb3917
Reset some flags for bridges.
odersky Apr 23, 2015
979ee0f
Fix changeOwnerAfter by adding transformDenotations method.
odersky Apr 23, 2015
bcc6bf7
Remove dead code in Constructors
odersky Apr 23, 2015
a2813d2
Mixin: do not remove Module Flag.
DarkDimius Apr 22, 2015
5937b88
Make LazyVals implement non-static modules. Move LV after erasure.
DarkDimius Apr 22, 2015
fe8c717
Add a test for a deferred object in interface.
DarkDimius Apr 22, 2015
9c150c5
Getters now also makes getters for lazy vals.
DarkDimius Apr 22, 2015
a274d8d
Generate getters for modules in LV.
DarkDimius Apr 24, 2015
cf4ee1d
LV runs after memoize. Use setters.
DarkDimius Apr 24, 2015
a049c82
Fix two infinite cycles in transformAfter.
DarkDimius Apr 24, 2015
f9a15df
Mixing should make initialisers out of lazy vals.
DarkDimius Apr 27, 2015
d0f9d6d
Compiler: add comment on problems in late phases.
DarkDimius Apr 27, 2015
75588e9
tpd.WhileDo helper.
DarkDimius Apr 27, 2015
74054a4
LazyVals needs to run after Mixin.
DarkDimius Apr 27, 2015
c201309
LazyVals: filter out flag combinations that do not make sense.
DarkDimius Apr 27, 2015
7517d99
LazyVals: create less names.
DarkDimius Apr 27, 2015
f8f908f
LazyVals: Emitting switch instruction requires default case.
DarkDimius Apr 27, 2015
4615f76
Make LazyVals.getOffset work on j.l.Class instead of taking the insta…
DarkDimius Apr 27, 2015
d75d872
Remove code duplication in LazyVals.
DarkDimius Apr 27, 2015
f322c98
LazyValues: minor post-erasure changes.
DarkDimius Apr 27, 2015
ca11f55
Make Lazy-vals generated fields private.
DarkDimius Apr 27, 2015
fc20556
Fix tpd.ref(sum) to work after erasure.
DarkDimius Apr 27, 2015
f892614
Update comment on ExplicitOuter.
DarkDimius Apr 27, 2015
dd65b3e
We do not plan to have more than Int.MaxValue of lazy vals.
DarkDimius Apr 27, 2015
086b1c2
LazyVals: expected value of flag takes only tree values, no need to u…
DarkDimius Apr 27, 2015
7ef1bd5
Disable failing tests. See #503
DarkDimius Apr 28, 2015
e24a24d
LazyVals - do not rely on absence of name clashes in scope.
DarkDimius Apr 28, 2015
4a379ec
LazyVals: Synchronized is `Object => Object` after erasure, #505
DarkDimius Apr 28, 2015
52c56a2
LazyVals: eagerly enter private symbols.
DarkDimius Apr 28, 2015
19c8220
fix a bug in transformAfter: iterate over a new denotation instead of…
DarkDimius Apr 28, 2015
56195fc
Fix bug in transformAfter: transform the last denotation in cycle.
DarkDimius Apr 28, 2015
4e277dc
Fix spurious warnings in TreeChecker.
DarkDimius Apr 28, 2015
9bf697c
LazyVals: last fix that allows to compile -deep dotc.
DarkDimius Apr 28, 2015
b5f76e5
Enable emmiting byte code for all tests. Compile Dotty.
DarkDimius Apr 28, 2015
3b4c230
Increase heap and stack size on travis.
DarkDimius Apr 28, 2015
c4b61af
DottyBackendInterface: interface members cannot be final
DarkDimius Apr 30, 2015
10d05f3
Decrease default sizes of buffers.
DarkDimius Apr 30, 2015
ceb2edd
Fix two ArrayIndexOutOfBoundsExceptions in TastyBuffer.
DarkDimius Apr 30, 2015
dc21d95
Leave traces for future profiling.
DarkDimius Apr 30, 2015
98f8ab8
LV: Rename methods.
DarkDimius Apr 30, 2015
61f0517
Comment why LazyVals needs to reorder stats in blocks.
DarkDimius Apr 30, 2015
3964a18
LV: change naming convention.
DarkDimius Apr 30, 2015
d23e71a
Replace .entered by .enteredAfter in LazyVals.
DarkDimius Apr 30, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import java.nio.channels.FileLock

object DottyBuild extends Build {

val travisMemLimit = List("-Xmx1g", "-Xss2m")

val TRAVIS_BUILD = "dotty.travis.build"

val agentOptions = List(
// "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
// "-agentpath:/home/dark/opt/yjp-2013-build-13072/bin/linux-x86-64/libyjpagent.so"
// "-agentpath:/Applications/YourKit_Java_Profiler_2015_build_15052.app/Contents/Resources/bin/mac/libyjpagent.jnilib",
// "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1g", "-Xss2m"
)

var partestLock: FileLock = null
Expand Down Expand Up @@ -79,7 +83,7 @@ object DottyBuild extends Build {

val travis_build = // propagate if this is a travis build
if (sys.props.isDefinedAt(TRAVIS_BUILD))
List(s"-D$TRAVIS_BUILD=${sys.props(TRAVIS_BUILD)}")
List(s"-D$TRAVIS_BUILD=${sys.props(TRAVIS_BUILD)}") ::: travisMemLimit
else
List()

Expand Down
6 changes: 3 additions & 3 deletions src/dotty/runtime/LazyVals.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ object LazyVals {
final val BITS_PER_LAZY_VAL = 2
final val LAZY_VAL_MASK = 3

@inline def STATE(cur: Long, ord: Long) = (cur >> (ord * BITS_PER_LAZY_VAL)) & LAZY_VAL_MASK
@inline def CAS(t: Object, offset: Long, e: Long, v: Long, ord: Int) = {
@inline def STATE(cur: Long, ord: Int) = (cur >> (ord * BITS_PER_LAZY_VAL)) & LAZY_VAL_MASK
@inline def CAS(t: Object, offset: Long, e: Long, v: Int, ord: Int) = {
val mask = ~(LAZY_VAL_MASK << ord * BITS_PER_LAZY_VAL)
val n = (e & mask) | (v << (ord * BITS_PER_LAZY_VAL))
compareAndSet(t, offset, e, n)
Expand Down Expand Up @@ -65,7 +65,7 @@ object LazyVals {
monitors(id)
}

@inline def getOffset(obj: Object, name: String) = unsafe.objectFieldOffset(obj.getClass.getDeclaredField(name))
@inline def getOffset(clz: Class[_], name: String) = unsafe.objectFieldOffset(clz.getDeclaredField(name))

object Names {
final val state = "STATE"
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/backend/jvm/DottyBackendInterface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
def isDeferred: Boolean = sym is Flags.Deferred
def isPrivate: Boolean = sym is Flags.Private
def getsJavaFinalFlag: Boolean =
isFinal && !toDenot(sym).isClassConstructor && !(sym is Flags.Mutable) && !(sym.enclosingClass is Flags.JavaInterface)
isFinal && !toDenot(sym).isClassConstructor && !(sym is Flags.Mutable) && !(sym.enclosingClass is Flags.Trait)

def getsJavaPrivateFlag: Boolean =
isPrivate //|| (sym.isPrimaryConstructor && sym.owner.isTopLevelModuleClass)
Expand Down
8 changes: 4 additions & 4 deletions src/dotty/tools/dotc/Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ class Compiler {
List(new PatternMatcher,
new ExplicitOuter,
new Splitter),
List(new LazyVals,
new SeqLiterals,
List(new SeqLiterals,
new InterceptedMethods,
new Literalize,
new Getters,
new ElimByName,
new ResolveSuper),
List(new Erasure),
List(new Mixin,
new LazyVals,
new Memoize,
new CapturedVars,
new CapturedVars, // capturedVars has a transformUnit: no phases should introduce local mutable vars here
new Constructors,
new FunctionalInterfaces),
List(new LambdaLift,
List(new LambdaLift, // in this mini-phase block scopes are incorrect. No phases that rely on scopes should be here
new Flatten,
new RestoreScopes),
List(/*new PrivateToStatic,*/ new CollectEntryPoints, new LabelDefs, new ElimWildcardIdents, new TraitConstructors),
Expand Down
32 changes: 28 additions & 4 deletions src/dotty/tools/dotc/ast/tpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dotty.tools
package dotc
package ast

import dotty.tools.dotc.transform.ExplicitOuter
import dotty.tools.dotc.typer.ProtoTypes.FunProtoTyped
import transform.SymUtils._
import core._
Expand Down Expand Up @@ -243,6 +244,17 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
ta.assignType(untpd.TypeDef(cls.name, impl), cls)
}

// { <label> def while$(): Unit = if (cond) { body; while$() } ; while$() }
def WhileDo(owner: Symbol, cond: Tree, body: List[Tree])(implicit ctx: Context): Tree = {
val sym = ctx.newSymbol(owner, nme.WHILE_PREFIX, Flags.Label | Flags.Synthetic,
MethodType(Nil, defn.UnitType), coord = cond.pos)

val call = Apply(ref(sym), Nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ref(sym).appliedToNone? (Not a strong opinion on this).

val rhs = If(cond, Block(body, call), unitLiteral)
Block(List(DefDef(sym, rhs)), call)
}


def Import(expr: Tree, selectors: List[untpd.Tree])(implicit ctx: Context): Import =
ta.assignType(untpd.Import(expr, selectors), ctx.newImportSymbol(ctx.owner, expr))

Expand Down Expand Up @@ -288,7 +300,16 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
if (tp.isType) TypeTree(tp)
else if (prefixIsElidable(tp)) Ident(tp)
else tp.prefix match {
case pre: SingletonType => singleton(pre).select(tp)
case pre: SingletonType =>
val prefix =
singleton(pre) match {
case t: This if ctx.erasedTypes && !(t.symbol == ctx.owner.enclosingClass || t.symbol.isStaticOwner) =>
// after erasure outer paths should be respected
new ExplicitOuter.OuterOps(ctx).path(t.tpe.widen.classSymbol)
case t =>
t
}
prefix.select(tp)
case pre => SelectFromTypeTree(TypeTree(pre), tp)
} // no checks necessary

Expand Down Expand Up @@ -563,7 +584,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
loop(from.owner, from :: froms, to :: tos)
else {
//println(i"change owner ${from :: froms}%, % ==> $tos of $tree")
new TreeTypeMap(oldOwners = from :: froms, newOwners = tos).apply(tree)
new TreeTypeMap(oldOwners = from :: froms, newOwners = tos)(ctx.withMode(Mode.FutureDefsOK)).apply(tree)
}
}
loop(from, Nil, to :: Nil)
Expand All @@ -578,8 +599,11 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
def traverse(tree: Tree)(implicit ctx: Context) = tree match {
case tree: DefTree =>
val sym = tree.symbol
if (sym.denot(ctx.withPhase(trans)).owner == from)
sym.copySymDenotation(owner = to).installAfter(trans)
if (sym.denot(ctx.withPhase(trans)).owner == from) {
val d = sym.copySymDenotation(owner = to)
d.installAfter(trans)
d.transformAfter(trans, d => if (d.owner eq from) d.copySymDenotation(owner = to) else d)
}
if (sym.isWeakOwner) traverseChildren(tree)
case _ =>
traverseChildren(tree)
Expand Down
38 changes: 30 additions & 8 deletions src/dotty/tools/dotc/core/Denotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -620,14 +620,9 @@ object Denotations {
// println(s"installing $this after $phase/${phase.id}, valid = ${current.validFor}")
// printPeriods(current)
this.validFor = Period(ctx.runId, targetId, current.validFor.lastPhaseId)
if (current.validFor.firstPhaseId == targetId) {
// replace current with this denotation
var prev = current
while (prev.nextInRun ne current) prev = prev.nextInRun
prev.nextInRun = this
this.nextInRun = current.nextInRun
current.validFor = Nowhere
} else {
if (current.validFor.firstPhaseId == targetId)
replaceDenotation(current)
else {
// insert this denotation after current
current.validFor = Period(ctx.runId, current.validFor.firstPhaseId, targetId - 1)
this.nextInRun = current.nextInRun
Expand All @@ -637,6 +632,33 @@ object Denotations {
}
}

/** Apply a transformation `f` to all denotations in this group that start at or after
* given phase. Denotations are replaced while keeping the same validity periods.
*/
protected def transformAfter(phase: DenotTransformer, f: SymDenotation => SymDenotation)(implicit ctx: Context): Unit = {
var current = symbol.current
while (current.validFor.firstPhaseId < phase.id && (current.nextInRun.validFor.code > current.validFor.code))
current = current.nextInRun
var hasNext = true
while ((current.validFor.firstPhaseId >= phase.id) && hasNext) {
val current1: SingleDenotation = f(current.asSymDenotation)
if (current1 ne current) {
current1.validFor = current.validFor
current1.replaceDenotation(current)
}
hasNext = current1.nextInRun.validFor.code > current1.validFor.code
current = current1.nextInRun
}
}

private def replaceDenotation(current: SingleDenotation): Unit = {
var prev = current
while (prev.nextInRun ne current) prev = prev.nextInRun
prev.nextInRun = this
this.nextInRun = current.nextInRun
current.validFor = Nowhere
}

def staleSymbolError(implicit ctx: Context) = {
def ownerMsg = this match {
case denot: SymDenotation => s"in ${denot.owner}"
Expand Down
6 changes: 6 additions & 0 deletions src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,12 @@ object SymDenotations {
/** Install this denotation as the result of the given denotation transformer. */
override def installAfter(phase: DenotTransformer)(implicit ctx: Context): Unit =
super.installAfter(phase)

/** Apply a transformation `f` to all denotations in this group that start at or after
* given phase. Denotations are replaced while keeping the same validity periods.
*/
override def transformAfter(phase: DenotTransformer, f: SymDenotation => SymDenotation)(implicit ctx: Context): Unit =
super.transformAfter(phase, f)
}

/** The contents of a class definition during a period
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/core/pickling/NameBuffer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import scala.io.Codec
import TastyName._
import PickleFormat._

class NameBuffer extends TastyBuffer(100000) {
class NameBuffer extends TastyBuffer(10000) {

private val nameRefs = new mutable.LinkedHashMap[TastyName, NameRef]

Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/core/pickling/PositionPickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object PositionPickler {
import PositionPickler._

class PositionPickler(pickler: TastyPickler, addrOfTree: Tree => Option[Addr]) {
val buf = new TastyBuffer(100000)
val buf = new TastyBuffer(5000)
pickler.newSection("Positions", buf)
import buf._

Expand Down
5 changes: 4 additions & 1 deletion src/dotty/tools/dotc/core/pickling/TastyBuffer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class TastyBuffer(initialSize: Int) {

/** Write a byte of data. */
def writeByte(b: Int): Unit = {
if (length == bytes.length) bytes = dble(bytes)
if (length >= bytes.length)
bytes = dble(bytes)
bytes(length) = b.toByte
length += 1
}
Expand Down Expand Up @@ -116,6 +117,8 @@ class TastyBuffer(initialSize: Int) {
def putNat(at: Addr, x: Int, width: Int): Unit = {
var y = x
var w = width
if(at.index + w >= bytes.length)
bytes = dble(bytes)
var digit = y & 0x7f | 0x80
while (w > 0) {
w -= 1
Expand Down
3 changes: 1 addition & 2 deletions src/dotty/tools/dotc/core/pickling/TreeBuffer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import TastyBuffer.{Addr, AddrWidth}
import config.Printers.pickling
import ast.tpd.Tree

class TreeBuffer extends TastyBuffer(1000000) {
class TreeBuffer extends TastyBuffer(50000) {

private final val ItemsOverOffsets = 2

private val initialOffsetSize = bytes.length / (AddrWidth * ItemsOverOffsets)
private var offsets = new Array[Int](initialOffsetSize)
private var isRelative = new Array[Boolean](initialOffsetSize)
Expand Down
14 changes: 6 additions & 8 deletions src/dotty/tools/dotc/transform/Constructors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,10 @@ class Constructors extends MiniPhaseTransform with SymTransformer { thisTransfor
// (2) If the parameter accessor reference was to an alias getter,
// drop the () when replacing by the parameter.
object intoConstr extends TreeMap {
private var excluded: FlagSet = _
override def transform(tree: Tree)(implicit ctx: Context): Tree = tree match {
case Ident(_) | Select(This(_), _) =>
var sym = tree.symbol
if (sym is (ParamAccessor, butNot = excluded)) sym = sym.subst(accessors, paramSyms)
if (sym is (ParamAccessor, butNot = Mutable)) sym = sym.subst(accessors, paramSyms)
if (sym.owner.isConstructor) ref(sym).withPos(tree.pos) else tree
case Apply(fn, Nil) =>
val fn1 = transform(fn)
Expand All @@ -95,9 +94,8 @@ class Constructors extends MiniPhaseTransform with SymTransformer { thisTransfor
if (noDirectRefsFrom(tree)) tree else super.transform(tree)
}

def apply(tree: Tree, inSuperCall: Boolean = false)(implicit ctx: Context): Tree = {
this.excluded = if (inSuperCall) EmptyFlags else Mutable
transform(tree)
def apply(tree: Tree, prevOwner: Symbol)(implicit ctx: Context): Tree = {
transform(tree).changeOwnerAfter(prevOwner, constr.symbol, thisTransform)
}
}

Expand Down Expand Up @@ -153,19 +151,19 @@ class Constructors extends MiniPhaseTransform with SymTransformer { thisTransfor
val sym = stat.symbol
if (isRetained(sym)) {
if (!stat.rhs.isEmpty && !isWildcardArg(stat.rhs))
constrStats += Assign(ref(sym), intoConstr(stat.rhs)).withPos(stat.pos)
constrStats += Assign(ref(sym), intoConstr(stat.rhs, sym)).withPos(stat.pos)
clsStats += cpy.ValDef(stat)(rhs = EmptyTree)
}
else if (!stat.rhs.isEmpty) {
sym.copySymDenotation(
initFlags = sym.flags &~ Private,
owner = constr.symbol).installAfter(thisTransform)
constrStats += intoConstr(stat)
constrStats += intoConstr(stat, sym)
}
case _: DefTree =>
clsStats += stat
case _ =>
constrStats += intoConstr(stat)
constrStats += intoConstr(stat, tree.symbol)
}
splitStats(stats1)
case Nil =>
Expand Down
4 changes: 3 additions & 1 deletion src/dotty/tools/dotc/transform/Erasure.scala
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ object Erasure extends TypeTestsCasts{

traverse(newStats, oldStats)
}

private final val NoBridgeFlags = Flags.Accessor | Flags.Deferred | Flags.Lazy

/** Create a bridge DefDef which overrides a parent method.
*
Expand All @@ -520,7 +522,7 @@ object Erasure extends TypeTestsCasts{
???
}
val bridge = ctx.newSymbol(currentClass,
parentSym.name, parentSym.flags | Flags.Bridge, parentSym.info, coord = newDefSym.owner.coord).asTerm
parentSym.name, parentSym.flags &~ NoBridgeFlags | Flags.Bridge, parentSym.info, coord = newDefSym.owner.coord).asTerm
bridge.enteredAfter(ctx.phase.prev.asInstanceOf[DenotTransformer]) // this should be safe, as we're executing in context of next phase
ctx.debuglog(s"generating bridge from ${newDefSym} to $bridge")

Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/transform/ExplicitOuter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import collection.mutable
*
* - add outer parameters to constructors
* - pass outer arguments in constructor calls
* - replace outer this by outer paths.
*
* replacement of outer this by outer paths is done in Erasure.
* needs to run after pattern matcher as it can add outer checks and force creation of $outer
*/
class ExplicitOuter extends MiniPhaseTransform with InfoTransformer { thisTransformer =>
Expand Down
20 changes: 13 additions & 7 deletions src/dotty/tools/dotc/transform/Getters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ import Decorators._
/** Performs the following rewritings for fields of a class:
*
* <mods> val x: T = e
* --> <mods> <stable> def x: T = e
* --> <mods> <stable> <accessor> def x: T = e
* <mods> var x: T = e
* --> <mods> def x: T = e
* --> <mods> <accessor> def x: T = e
*
* <mods> val x: T
* --> <mods> <stable> def x: T
* --> <mods> <stable> <accessor> def x: T
*
* <mods> lazy val x: T = e
* --> <mods> <accessor> lazy def x: T =e
*
* <mods> var x: T
* --> <mods> def x: T
* --> <mods> <accessor> def x: T
*
* <mods> non-static <module> val x$ = e
* --> <mods> <module> <accessor> def x$ = e
*
* Omitted from the rewritings are
*
Expand All @@ -47,18 +53,18 @@ class Getters extends MiniPhaseTransform with SymTransformer { thisTransform =>
override def transformSym(d: SymDenotation)(implicit ctx: Context): SymDenotation = {
def noGetterNeeded =
d.is(NoGetterNeeded) ||
d.initial.asInstanceOf[SymDenotation].is(PrivateLocal) && !d.owner.is(Trait) ||
d.initial.asInstanceOf[SymDenotation].is(PrivateLocal) && !d.owner.is(Trait) && !d.is(Flags.Lazy) ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flags. is redundant here. Lazy is used without prefix elsewhere in the file.

d.is(Module) && d.isStatic ||
d.isSelfSym
if (d.isTerm && d.owner.isClass && d.info.isValueType && !noGetterNeeded) {
if (d.isTerm && (d.is(Lazy) || d.owner.isClass) && d.info.isValueType && !noGetterNeeded) {
val maybeStable = if (d.isStable) Stable else EmptyFlags
d.copySymDenotation(
initFlags = d.flags | maybeStable | AccessorCreationFlags,
info = ExprType(d.info))
}
else d
}
private val NoGetterNeeded = Method | Param | JavaDefined | JavaStatic | Lazy
private val NoGetterNeeded = Method | Param | JavaDefined | JavaStatic

override def transformValDef(tree: ValDef)(implicit ctx: Context, info: TransformerInfo): Tree =
if (tree.symbol is Method) DefDef(tree.symbol.asTerm, tree.rhs) else tree
Expand Down
Loading