-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
Compiler version
main
Minimized code
import language.experimental.captureChecking
trait Op:
def run(): Unit
def helper[X <: Op^](op: X): () -> Unit = () => op.run() // should be error, but ok
def runOpForFree(op: Op^): () -> Unit = () => helper(op)
Output
It compiles.
Expectation
But it shouldn't. It converts arbitrary impure operation into a pure one, which is clearly unsound.
After some initial investigation, this seems to be an interaction between type variables, boxes, and asSeenFrom
.
This is derived from the issue @noti0na1 showed during the group meeting.