Skip to content

Fix #23223: Add handling for classes deriving from Capability during Setup #23248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

noti0na1
Copy link
Member

@noti0na1 noti0na1 commented May 23, 2025

Fix #23223

Updated the Setup logic to handle classes deriving from Capability by adding a fresh capability.

@noti0na1
Copy link
Member Author

Error:

import language.experimental.captureChecking

class Cap extends caps.Capability:
  def use[T](body: Cap ?=> T) = body(using this)
-- [E007] Type Mismatch Error: tests/pos-custom-args/captures/i20237.scala:4:43 
4 |  def use[T](body: Cap ?=> T) = body(using this)
  |                                           ^^^^
  |Found:    (Cap.this : Cap^{cap.rd})
  |Required: Cap^{cap².rd}
  |
  |where:    cap  is the universal root capability
  |          cap² is a fresh root capability created in method use when checking argument to parameter x$0 of method apply

@noti0na1
Copy link
Member Author

cc @Linyxus

@noti0na1 noti0na1 marked this pull request as ready for review May 23, 2025 14:24
@noti0na1 noti0na1 requested a review from Copilot May 23, 2025 14:24
Copilot

This comment was marked as resolved.

@noti0na1 noti0na1 changed the title Add handling for classes deriving from Capability during Setup Fix #23223: Add handling for classes deriving from Capability during Setup May 23, 2025
@noti0na1 noti0na1 requested a review from odersky May 23, 2025 19:32
@noti0na1 noti0na1 requested a review from Linyxus May 23, 2025 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing inheritance check for Capability classes
2 participants