Skip to content

Commit e8bdc58

Browse files
committed
Add documentation
1 parent 7f25d54 commit e8bdc58

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

compiler/src/dotty/tools/dotc/typer/Inliner.scala

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,16 @@ object Inliner {
4848
def accessorNameKind = InlineAccessorName
4949

5050
/** A definition needs an accessor if it is private, protected, or qualified private
51-
* and it is not part of the tree that gets inlined. The latter test is implemented
52-
* by excluding all symbols properly contained in the inlined method.
53-
*/
51+
* and it is not part of the tree that gets inlined. The latter test is implemented
52+
* by excluding all symbols properly contained in the inlined method.
53+
*
54+
* Constants don't need accessors since they are inlined in FirstTransform.
55+
*/
5456
def needsAccessor(sym: Symbol)(implicit ctx: Context) =
5557
sym.isTerm &&
56-
!sym.info.widenTermRefExpr.isInstanceOf[ConstantType] &&
5758
(sym.is(AccessFlags) || sym.privateWithin.exists) &&
58-
!sym.isContainedIn(inlineSym)
59+
!sym.isContainedIn(inlineSym) &&
60+
!sym.info.widenTermRefExpr.isInstanceOf[ConstantType]
5961

6062
def preTransform(tree: Tree)(implicit ctx: Context): Tree
6163

0 commit comments

Comments
 (0)