File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ import Decorators._
95
95
def adaptToField (tree : Tree ) =
96
96
if (tree.isEmpty) tree else tree.ensureConforms(field.info.widen)
97
97
98
+ val NoFieldNeeded = Lazy | Deferred | JavaDefined | (if (ctx.settings.YnoInline .value) EmptyFlags else Inline )
99
+
98
100
if (sym.is(Accessor , butNot = NoFieldNeeded ))
99
101
if (sym.isGetter) {
100
102
var rhs = tree.rhs.changeOwnerAfter(sym, field, thisTransform)
@@ -112,5 +114,4 @@ import Decorators._
112
114
// neither getters nor setters
113
115
else tree
114
116
}
115
- private val NoFieldNeeded = Lazy | Deferred | JavaDefined | Inline
116
117
}
Original file line number Diff line number Diff line change @@ -1195,19 +1195,14 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1195
1195
* see remark about idempotency in PostTyper#normalizeTree
1196
1196
*/
1197
1197
private def patchFinalVals (vdef : ValDef )(implicit ctx : Context ): Unit = {
1198
- def skipBlocks (t : Tree ): Tree = t match {
1199
- case Block (_, t1) => skipBlocks(t1)
1200
- case _ => t
1201
- }
1202
1198
def isFinalInlinableVal (sym : Symbol ): Boolean = {
1203
1199
sym.is(Final , butNot = Mutable ) &&
1204
1200
isIdempotentExpr(vdef.rhs) /* &&
1205
1201
ctx.scala2Mode (stay compatible with Scala2 for now) */
1206
1202
}
1207
1203
val sym = vdef.symbol
1208
- skipBlocks(vdef.rhs) match {
1209
- case lit : Literal if isFinalInlinableVal(sym) && ! ctx.settings.YnoInline .value =>
1210
- sym.flags = sym.flags | Inline
1204
+ sym.info match {
1205
+ case info : ConstantType if isFinalInlinableVal(sym) && ! ctx.settings.YnoInline .value => sym.setFlag(Inline )
1211
1206
case _ =>
1212
1207
}
1213
1208
}
You can’t perform that action at this time.
0 commit comments