-
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 expansion and unexpansion of mixin qualified names
A mixin qualifier foo$A is a qualified name. Previously these were flattened to SimpleNames when expanding with a trait prefix. But then ResolveSuper cannot decompose the name anymore. To fix this, we now treat QualifiedNames specially in the replace calls for SymDenotations#fullNameSeparated and NameOps#unexpanded. Qualifiers are preserved and the replacement proceeds recursively to their underlying part. For some as yet unknown reason we can't do this for TraitSetterNames. It seems these need to be flattened. Fixes #15702
- Loading branch information
Showing
5 changed files
with
47 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
10 | ||
20 | ||
200 |
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,29 @@ | ||
abstract class A: | ||
val n: Int | ||
def foo(): Int = n | ||
|
||
trait B: | ||
val m: Int | ||
def foo(): Int = m | ||
|
||
trait M extends A with B: | ||
val a: Int | ||
override def foo(): Int = a + super.foo() | ||
|
||
trait N extends A with B: | ||
val b: Int | ||
override def foo(): Int = b * super.foo() | ||
|
||
class Inner: | ||
println(N.super[A].foo()) | ||
println(N.super.foo()) | ||
println(foo()) | ||
|
||
object C extends A with M with N: | ||
val a = 10 | ||
val b = 10 | ||
val m = 10 | ||
val n = 10 | ||
new Inner() | ||
|
||
@main def Test = C |