Skip to content

Commit 1c302e6

Browse files
committed
Test absence of outer field in a run test
1 parent 1c590f7 commit 1c302e6

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

tests/pos/i11367.scala

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/run/i11367.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class C$G has outer fields

tests/run/i11367.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
trait NoOuter:
2+
val outerFields = getClass.getDeclaredFields.filter(_.getName.contains("$outer"))
3+
if outerFields.nonEmpty then println(s"$getClass has outer fields")
4+
5+
class C extends NoOuter:
6+
def foo =
7+
class D extends NoOuter:
8+
class E extends NoOuter
9+
class F extends NoOuter
10+
val d = D()
11+
d.E()
12+
F()
13+
class G extends NoOuter
14+
15+
@main def Test =
16+
val c = C()
17+
c.foo
18+
c.G()

0 commit comments

Comments
 (0)