File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed
src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -220,9 +220,14 @@ object ExplicitOuter {
220
220
case id : Ident =>
221
221
id.tpe match {
222
222
case ref @ TermRef (NoPrefix , _) =>
223
- ref.symbol.is(Hoistable ) && isOuter(id.symbol.owner.enclosingClass)
224
- // methods will be placed in enclosing class scope by LambdaLift, so they will get
225
- // an outer path then.
223
+ if (ref.symbol is Hoistable )
224
+ // ref.symbol will be placed in enclosing class scope by LambdaLift, so it might need
225
+ // an outer path then.
226
+ isOuter(ref.symbol.owner.enclosingClass)
227
+ else
228
+ // ref.symbol will get a proxy in immediately enclosing class. If this properly
229
+ // contains the current class, it needs an outer path.
230
+ ctx.owner.enclosingClass.owner.enclosingClass.isContainedIn(ref.symbol.owner)
226
231
case _ => false
227
232
}
228
233
case nw : New =>
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def test = {
3
+ val myName : String = " "
4
+ new AnyRef {
5
+ new Exception {
6
+ def name = myName
7
+ }
8
+ }
9
+ new AnyRef {
10
+ new Exception {
11
+ new AnyRef {
12
+ def name = myName
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
You can’t perform that action at this time.
0 commit comments