-
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.
Don't re-balance AndTypes arising from supertypes (#20400)
#20284 started breaking since we now balance AndTypes to avoid performance drops. But (re-)balancing an AndType interferes with the logic that determines which symbol is referred by a super select. This is fixed by two changes: - Form types of super with `AndType` instead of `&` - Don't simplify types of super since that would rebalance the underlying AndTypes. Fixes #20284
- Loading branch information
Showing
4 changed files
with
74 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
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,15 @@ | ||
Test 1 | ||
D | ||
B | ||
C | ||
A | ||
Test 2 | ||
D | ||
B | ||
C | ||
A | ||
Test 3 | ||
D | ||
B | ||
C | ||
A |
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,54 @@ | ||
trait A { | ||
def print: Unit = println("A") | ||
} | ||
|
||
trait B extends A { | ||
override def print: Unit = { | ||
println("B") | ||
super.print | ||
} | ||
} | ||
|
||
trait C extends A { | ||
override def print: Unit = { | ||
println("C") | ||
super.print | ||
} | ||
} | ||
|
||
trait D extends B { | ||
override def print: Unit = { | ||
println("D") | ||
super.print | ||
} | ||
} | ||
|
||
trait BB extends B | ||
|
||
trait X | ||
trait Y | ||
trait Z | ||
|
||
class Test1 extends C with B with BB with D with X with Y with Z: | ||
override def print: Unit = { | ||
println("Test 1") | ||
super.print | ||
} | ||
|
||
class Test2 extends C with B with BB with D with X with Y { | ||
override def print: Unit = { | ||
println("Test 2") | ||
super.print | ||
} | ||
} | ||
|
||
class Test3 extends X with Y with Z with C with B with BB with D { | ||
override def print: Unit = { | ||
println("Test 3") | ||
super.print | ||
} | ||
} | ||
@main def Test = | ||
new Test1().print | ||
new Test2().print | ||
new Test3().print |