Closed
Description
Compiler version
3.5-RC1
Minimized example
class Async
class C(val x: Async ?=> Unit)
def foo(x: Async ?=> Unit): C^{x} = C(x)
def foo(x: Async ?=> Unit)(using Async): C^{x} = C(x)
Output
-- [E172] Type Error: cfun-capturerefs.scala:3:32 ------------------------------
3 |def foo(x: Async ?=> Unit): C^{x} = C(x)
| ^
|No given instance of type Async was found for parameter of (Async) ?=> Unit
|Where (Async) ?=> Unit is an alias of: (Async) ?=> Unit
-- Error: cfun-capturerefs.scala:4:44 ------------------------------------------
4 |def foo(x: Async ?=> Unit)(using Async): C^{x} = C(x)
| ^
| x.apply(x$2): Unit is not a legal element of a capture set
Expectation
Should compile