Skip to content
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

Paths to abstract CapSet members within capture sets are rejected #21870

Closed
bracevac opened this issue Oct 31, 2024 · 2 comments
Closed

Paths to abstract CapSet members within capture sets are rejected #21870

bracevac opened this issue Oct 31, 2024 · 2 comments
Labels
area:experimental:cc Capture checking related itype:bug

Comments

@bracevac
Copy link
Contributor

bracevac commented Oct 31, 2024

Compiler version

Latest NIGHTLY

Minimized code

import language.experimental.captureChecking
import caps._

trait Foo extends Capability

trait CaptureSet:
  type C <: CapSet^

def test =
  val x: Foo^ = ???

  object X extends CaptureSet:
    type C = CapSet^{x}

  val y: Foo^{X.C^} = x // error

Output

-- Error: local/ccpaths.scala:70:15 --------------------------------------------
70 |  val u: Foo^{X.C^} = x
   |              ^^^^
   |X.C is not a legal prefix for `^` here,
   |is must be a type parameter or abstract type with a caps.CapSet upper bound.

Expectation

It should be accepted (+ the error message has a typo).

@bracevac bracevac added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label area:experimental:cc Capture checking related and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Oct 31, 2024
@bracevac
Copy link
Contributor Author

@noti0na1

@noti0na1
Copy link
Member

noti0na1 commented Nov 1, 2024

def isLegalCapsOfArg =
  arg.symbol.isAbstractOrParamType && arg.symbol.info.derivesFrom(defn.Caps_CapSet)

Changing isAbstractOrParamType to isType will work. Not sure why we had the requirement for abstract type at beginning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:experimental:cc Capture checking related itype:bug
Projects
None yet
Development

No branches or pull requests

2 participants