-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Defining and Transforming Capabilities from other Capabilities #21614
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
Comments
The issue is probably linked the expansion of case classes that extend |
@odersky it also fails if we make |
I verified that this version compiles: import language.experimental.captureChecking
import caps.Capability
import caps.unbox
trait File extends Capability
class Logger(f: File^) // <- will work if we remove the extends clause
def mkLoggers(@unbox files: List[File^]): List[Logger^] = files.map(new Logger(_)) Which variant did you have in mind? |
Unrelated problem: This also fails. def mkLoggers1[F <: File^](@unbox files: List[F]): List[Logger^] =
files.map((f: F) => new Logger(f)) Here's the error trace:
It has to do with boxing. Somehow we don't realize that if |
I suspect this is a known issue #19076. |
Basically, to correctly handle these cases it seems necessary to interleave subtyping and box adaptation. I remember Yaoyu @noti0na1 once had a look at this issue. |
It fails again when inheriting from class Logger(f: File^) extends Capability So I'm not sure if the issue is tied to case classes specifically. |
Yes, my failure is a duplicate of #19076. Something we need to fix, but it does not look easy. About I'll add it as a test case so we can maybe track better error messages in the future. |
Compiler version
3.6-NIGHTLY
Minimized code
Output
Expectation
The example should compile. It compiles if we omit
extends Capability
forLogger
, but I would expect thatLogger
should be tracked as a capability.The text was updated successfully, but these errors were encountered: