Skip to content

Commit f71dca2

Browse files
committed
Made inliner work for @inline methods that access private variables.
We need to disable the previous "potentiallyPublished" logic for this because that one disables inlining as long as the inlined method has a reference to a field with a $. But making fields public in @inline method will generate fields with $. We need to complement this with reverting the previous publication logic completely. I leave that to Vlad or Miguel.
1 parent 0e2080e commit f71dca2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/compiler/scala/tools/nsc/backend/opt/Inliners.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,13 +661,15 @@ abstract class Inliners extends SubComponent {
661661
*
662662
* TODO handle more robustly the case of a trait var changed at the source-level from public to private[this]
663663
* (eg by having ICodeReader use unpickler, see SI-5442).
664-
* */
664+
665+
DISABLED
666+
665667
def potentiallyPublicized(f: Symbol): Boolean = {
666668
(m.sourceFile eq NoSourceFile) && f.name.containsChar('$')
667669
}
670+
*/
668671

669-
def checkField(f: Symbol) = check(f, potentiallyPublicized(f) ||
670-
(f.isPrivate && !canMakePublic(f)))
672+
def checkField(f: Symbol) = check(f, f.isPrivate && !canMakePublic(f))
671673
def checkSuper(n: Symbol) = check(n, n.isPrivate || !n.isClassConstructor)
672674
def checkMethod(n: Symbol) = check(n, n.isPrivate)
673675

0 commit comments

Comments
 (0)