-
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.
Change logic to find members of recursive types (#17386)
The previous logic used two boolean variables to selectively create defensive copies. It was quite complicated. The new logic is simpler and copies less. - It copies only if the same recursive type is accessed with two different prefixes. As long as the prefix stays the same,no confusion in the `substRecThis` is possible. - It avoids the openedTwice logic that causes defensive copies at all points in the future. It seems that trick is no longer necessary. Fixes #17380 by avoiding infinite recursion due to defensive copies. Fixes #17381 as well.
- Loading branch information
Showing
3 changed files
with
25 additions
and
23 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,3 @@ | ||
class C { type T; type U } | ||
|
||
type X = C { type U = T; def u: U } { type T = String } |
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 @@ | ||
import reflect.Selectable.reflectiveSelectable | ||
|
||
type Y = { type T = String; def u(): T } | ||
|
||
trait Test { | ||
|
||
val y1: Y | ||
val y2 = y1.u() | ||
} |