Commit e05e3a3
authored
Flatten nested capture sets in retainedElementsRaw (#23571)
Without the added clause, i23570 looks like this after typer:
```scala
[[syntax trees at end of typer]] // i23570.scala
package <empty> {
final lazy module val i23570$package: i23570$package = new i23570$package()
final module class i23570$package() extends Object() {
this: i23570$package.type =>
def f[C >: scala.caps.CapSet <: scala.caps.CapSet^{cap}](
xs: List[(() -> Unit)^{C}]): List[(() -> Unit)^{C}] = xs.reverse
def test(io: Object^{cap}, async: Object^{cap}): Unit =
{
val ok: List[() ->{scala.caps.CapSet^{io}} Unit] =
f[_root_.scala.caps.CapSet^{io}](Nil)
val x:
List[() ->{scala.caps.CapSet^{io}} Unit] ->
List[() ->{scala.caps.CapSet^{io}} Unit]
= (xs: List[() ->{scala.caps.CapSet^{io}} Unit]) =>
f[_root_.scala.caps.CapSet^{io}](xs)
val y:
List[() ->{scala.caps.CapSet^{io, async}} Unit] ->
List[() ->{scala.caps.CapSet^{io, async}} Unit]
= (xs: List[() ->{scala.caps.CapSet^{io, async}} Unit]) =>
f[_root_.scala.caps.CapSet^{io, async}](xs)
()
}
}
}
```
Note the nested capture sets in the types of `x` and `y`.
Fixes #23570File tree
3 files changed
+33
-0
lines changed- compiler/src/dotty/tools/dotc/cc
- tests
- pos-custom-args/captures
- pos
3 files changed
+33
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
0 commit comments