-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:experimental:ccCapture checking relatedCapture checking relatedcc-experimentIntended to be merged with cc-experiment branch on originIntended to be merged with cc-experiment branch on originitype:bug
Description
Compiler version
main
Minimized code
import language.experimental.captureChecking
@annotation.capability
class CanIO
def allowIO[T](op: (c: CanIO) => T): T = ???
def bad(c: CanIO): CanIO = c
def test: Unit = {
val ok = allowIO(bad) // error
val boom = allowIO[CanIO](bad) // should be an error, too
}Output
-- [E007] Type Mismatch Error: issues/capclass.scala:30:19 ---------------------------------------------------------------------------------------------------------------------------------------------
30 | val ok = allowIO(bad) // error
| ^^^
| Found: ? CanIO -> {*} CanIO
| Required: (c: CanIO) => box {*} CanIO
|
| longer explanation available when compiling with `-explain`
1 error foundExpectation
Both ok and boom should issue an error, but now boom won't b/c of the explicit type argument. This is because in Setup the type arugment CanIO in allowIO[CanIO] will not be boxed when it is written out explicitly.
Metadata
Metadata
Assignees
Labels
area:experimental:ccCapture checking relatedCapture checking relatedcc-experimentIntended to be merged with cc-experiment branch on originIntended to be merged with cc-experiment branch on originitype:bug