File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
compiler/src/dotty/tools/dotc/transform/localopt Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -175,13 +175,14 @@ object Simplify {
175175 }
176176
177177 def isImmutableAccessor (t : Tree )(implicit ctx : Context ): Boolean = {
178- val isImmutableGetter = t.symbol.isGetter && ! t.symbol.is(Mutable | Lazy )
179- val isCaseAccessor = t.symbol.is(CaseAccessor ) && ! t.symbol.is(Mutable | Lazy )
180- val isProductAccessor = t.symbol.exists &&
181- t.symbol.owner.derivesFrom(defn.ProductClass ) &&
182- t.symbol.owner.is(CaseClass ) &&
183- t.symbol.name.isSelectorName &&
184- ! t.symbol.info.decls.exists(_.is(Mutable | Lazy )) // Conservatively covers case class A(var x: Int)
178+ val sym = t.symbol
179+ val isImmutableGetter = sym.isGetter && ! sym.is(Mutable | Lazy )
180+ val isCaseAccessor = sym.is(CaseAccessor ) && ! sym.is(Mutable | Lazy )
181+ val isProductAccessor = sym.exists &&
182+ sym.owner.derivesFrom(defn.ProductClass ) &&
183+ sym.owner.is(CaseClass ) &&
184+ sym.name.isSelectorName &&
185+ ! sym.info.decls.exists(_.is(Mutable | Lazy )) // Conservatively covers case class A(var x: Int)
185186 isImmutableGetter || isCaseAccessor || isProductAccessor
186187 }
187188}
You can’t perform that action at this time.
0 commit comments