-
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.
Fix enclosingClass from returning refinement classes
Looking at how i20952 is compiled, the call ctx.owner.enclosingClass.derivesFrom(sym.owner) in SuperAccessors (that I moved to ProtectedAccessors) accidentally fails, because the refinement class returned as the enclosing class of `val prog` doesn't derive from SuperClass. But if the enclosing class of `prog` returned is `trait Child` then no super accessor call is necessary.
- Loading branch information
Showing
5 changed files
with
29 additions
and
6 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
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
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,20 @@ | ||
package object packer: // the super class needs to be in a different package | ||
class SuperClass(): | ||
protected val problem: Any = ??? // needs to be protected | ||
|
||
class SuperClass(): | ||
protected val problem: Any = ??? // needs to be protected | ||
|
||
// type Target = SuperClass // passes | ||
type Target = packer.SuperClass // error | ||
|
||
trait Child extends Target: | ||
|
||
val aliased: problem.type = problem | ||
type Alias = problem.type | ||
|
||
val newProblem: Any {val prog: problem.type} = ??? // error | ||
val newProblem2: Any {val prog: Alias} = ??? // passes | ||
val newProblem3: Any {val prog: aliased.type} = ??? // passes | ||
|
||
class ChildImpl extends Target with Child // concrete implementation is needed |