Closed
Description
Compiler version
3.6.0-RC1-bin-20240924-3f4fee2-NIGHTLY-git-3f4fee2
Minimized code
import language.experimental.captureChecking
import caps.Capability
trait File extends Capability
class Resource[T <: Capability](gen: T):
def use[U](f: T => U): U =
f(gen)
@main def run =
val myFile: File = ???
val r = Resource(myFile)
()
Edit: minimized further
Output (click arrow to expand)
[error] ## Exception when compiling 1 sources to /Users/oliver/playground/caps/caps/target/scala-3.6.0-RC1-bin-20240924-3f4fee2-NIGHTLY/classes
[error] dotty.tools.dotc.core.TypeError$$anon$1: invalid new prefix [T <: box caps.Capability^] =>> Test.Resource[box T^] cannot replace Test.Resource in type (Test.Resource#<init> : [T <: box caps.Capability^](gen: T^): Test.Resource[T])