forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix scala#1401: Make sure all refs are forwarded
Faced with recursive dependencies through self types, we might have to apply `normalizeToClassRefs` to a class P with a parent that is not yet initialized (witnessed by P's parents being Nil). In that case we should still execute forwardRefs on P, but we have to wait in a suspension until P is initialized. This avoids the problem raised in scala#1401. I am still not quite sure why forwardRefs is needed, but it seems that asSeenFrom alone is not enough to track the dependencies in this case.
- Loading branch information
Showing
6 changed files
with
59 additions
and
10 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
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,25 @@ | ||
package i1401 | ||
|
||
trait Subtractable[A, +Repr <: Subtractable[A, Repr]] { | ||
def -(elem: A): Repr | ||
} | ||
|
||
trait BufferLike[BA, +This <: BufferLike[BA, This] with Buffer[BA]] | ||
extends Subtractable[BA, This] | ||
{ self : This => | ||
|
||
/* Without fix-#1401: | ||
* | ||
error: overriding method - in trait Subtractable of type (elem: A)This & i1401.Buffer[A]; | ||
method - of type (elem: BA)This has incompatible type | ||
def -(elem: BA): This | ||
^ | ||
one error found | ||
*/ | ||
def -(elem: BA): This | ||
} | ||
|
||
trait Buffer[A] extends BufferLike[A, Buffer[A]] | ||
|
||
|
||
|