-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use isStatic intsead of isStaticOwner in hasLocalInstantiation
Co-Authored-By: Dale Wijnand <[email protected]> Co-Authored-By: noti0na1 <[email protected]> Co-Authored-By: odersky <[email protected]>
- Loading branch information
1 parent
9715eed
commit 6408889
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
List(public T1$C1()) | ||
List(public T2$$anon$1$C2()) | ||
List(public T3$C3$1()) | ||
List(public T4$$anon$2$C4()) | ||
List(public T5$C5(T5)) | ||
List(public T6$$anon$3$C6()) | ||
List(public T7$C7$1()) | ||
List(public T8$$anon$4$C8()) | ||
List(public T9$C9(T9)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// This test checks that references to outer classes in inner classes are | ||
// eliminated in some cases when they are not used. This is done is the | ||
// ExplicitOuter phase. See issue #19569 for discussions. | ||
|
||
object helper { | ||
def test(cls: Class[?]) = println(cls.getDeclaredConstructors.toList) | ||
} | ||
|
||
import helper.test | ||
|
||
object T1 { class C1; test(classOf[C1]) } | ||
object T2 { new AnyRef { class C2; test(classOf[C2]) } } | ||
object T3 { def t3(): Unit = { class C3; test(classOf[C3]) } } | ||
object T4 { def t4(): Unit = new AnyRef { class C4; test(classOf[C4]) } } | ||
|
||
class T5 { class C5; test(classOf[C5]) } // outer ref currently not elided | ||
class T6 { new AnyRef { class C6; test(classOf[C6]) } } | ||
class T7 { def t7(): Unit = { class C7; test(classOf[C7]) } } | ||
class T8 { def t8(): Unit = new AnyRef { class C8; test(classOf[C8]) } } | ||
|
||
// The outer ref is not elided when it is used: | ||
class T9 { var x = 451; class C9 {def getX = x}; test(classOf[C9]) } | ||
|
||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
T1 | ||
T2 | ||
T3.t3() | ||
T4.t4() | ||
new T5() | ||
new T6() | ||
new T7().t7() | ||
new T8().t8() | ||
new T9() | ||
} | ||
} |