Commit 28bb69c
committed
Flatten nested capture sets in retainedElementsRaw
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 #235701 parent fb66af2 commit 28bb69c
File tree
2 files changed
+9
-0
lines changed- compiler/src/dotty/tools/dotc/cc
- tests/pos-custom-args/captures
2 files changed
+9
-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 | + | |
0 commit comments