Skip to content

Capture checking rejects closure with parameter dependencies #23727

@Linyxus

Description

@Linyxus

Compiler version

main

Minimized code

import language.experimental.captureChecking import caps.* def test1(): Unit = val t1: (x: () => Unit) -> (y: () ->{x} Unit) -> Unit = x => y => () // should ok, but error

Output

5 | x => y => () // should ok, but error | ^^^^^^^^^^^^ | Found: (x: () => Unit) ->'s1 (y: () ->{x²} Unit) -> Unit | Required: (x²: () => Unit) -> (y: () ->{x²} Unit) -> Unit | | where: => refers to the universal root capability | x² is a reference to a value parameter | x² is a reference to a value parameter | | Note that capability x is not included in capture set {x}. | | longer explanation available when compiling with `-explain` 1 error found

Expectation

Should be ok.

It is probably related to #23700.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions