File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
compiler/src/dotty/tools/dotc/transform/localopt Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ class Simplify extends MiniPhaseTransform with IdentityDenotTransformer {
60
60
new Devalify ::
61
61
new Jumpjump ::
62
62
new DropGoodCasts ::
63
+ new DropNoEffects (this ) ::
63
64
new ConstantFold (this ) ::
64
65
Nil
65
66
@@ -168,13 +169,14 @@ object Simplify {
168
169
}
169
170
170
171
def isImmutableAccessor (t : Tree )(implicit ctx : Context ): Boolean = {
171
- val isImmutableGetter = t.symbol.isGetter && ! t.symbol.is(Mutable | Lazy )
172
- val isCaseAccessor = t.symbol.is(CaseAccessor ) && ! t.symbol.is(Mutable | Lazy )
173
- val isProductAccessor = t.symbol.exists &&
174
- t.symbol.owner.derivesFrom(defn.ProductClass ) &&
175
- t.symbol.owner.is(CaseClass ) &&
176
- t.symbol.name.isSelectorName &&
177
- ! t.symbol.info.decls.exists(_.is(Mutable | Lazy )) // Conservatively covers case class A(var x: Int)
172
+ val sym = t.symbol
173
+ val isImmutableGetter = sym.isGetter && ! sym.is(Mutable | Lazy )
174
+ val isCaseAccessor = sym.is(CaseAccessor ) && ! sym.is(Mutable | Lazy )
175
+ val isProductAccessor = sym.exists &&
176
+ sym.owner.derivesFrom(defn.ProductClass ) &&
177
+ sym.owner.is(CaseClass ) &&
178
+ sym.name.isSelectorName &&
179
+ ! sym.info.decls.exists(_.is(Mutable | Lazy )) // Conservatively covers case class A(var x: Int)
178
180
isImmutableGetter || isCaseAccessor || isProductAccessor
179
181
}
180
182
}
You can’t perform that action at this time.
0 commit comments