Skip to content

Capture set parameters upper bounded by cap.rd cannot be widened to cap.rd #23170

Closed
@natsukagami

Description

@natsukagami

Compiler version

Latest main (23469a1)

Minimized code

import language.experimental.captureChecking
import caps.*

trait A

extension (a: A^{cap.rd})
  def await = ()

def awaitA[C <: {cap.rd}](a: A^{C}) = a.await

Output

-- [E007] Type Mismatch Error: ../dotty-test/upcast-rd.scala:11:38 -------------
11 |def awaitA[C <: {cap.rd}](a: A^{C}) = a.await
   |                                      ^
   |Found:    (a : test.upcastrd.A^{C})
   |Required: test.upcastrd.A^{cap.rd}
   |
   |where:    cap is a fresh root capability created in method awaitA when checking argument to parameter a of method await
   |
   | longer explanation available when compiling with `-explain`

Expectation

Should compile.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions