-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Widens the criterion when outer fields can be omitted. It used to be that sub- and superclass had to be enclosed by the same outer class. Only in that case was the outer field of the class omitted. We now omit if subclass is contained in an outer class that is itself a subclass of the superclasses outer class. See test case "outertest.scala" for an example.
- Loading branch information
Showing
2 changed files
with
31 additions
and
2 deletions.
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,26 @@ | ||
// A test for the case where the outer field of class B#J should be eliminated. | ||
// You can verify this by running a javap on B.J | ||
abstract class A { | ||
|
||
abstract class I { | ||
|
||
} | ||
|
||
val foo = "foo" | ||
|
||
} | ||
|
||
class B extends A { | ||
|
||
class J extends I { | ||
val bar = foo | ||
} | ||
|
||
} | ||
|
||
object Test extends App { | ||
|
||
val b = new B | ||
assert((new b.J).bar == b.foo) | ||
|
||
} |