Skip to content

Can't pass an explicit capture set to a capset parameter in eta expansion #23570

@odersky

Description

@odersky

Compiler version

3.7.3

Minimized example

def f[C^](xs: List[() ->{C} Unit]): List[() ->{C} Unit] =
  xs.reverse

def test(io: Object^, async: Object^): Unit =
  val ok = f[{io}](Nil)  // ok
  val x = f[{io}]        // error
  val y = f[{io, async}] // error

Output

-- Error: explicit-cs-arg.scala:6:10 -------------------------------------------
6 | val x = f[{io}] // error
| ^
| Illegal capture reference: scala.caps.CapSet^{io}
-- Error: explicit-cs-arg.scala:7:10 -------------------------------------------
7 | val y = f[{io, async}] // error
| ^
| Illegal capture reference: scala.caps.CapSet^{io, async}
2 errors found

Expectation

No errors

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions