Open
Description
Compiler version
main
branch
Minimized code
import language.experimental.captureChecking
trait Cap { def use(): Unit }
def main(ct: {*} Cap, io: {*} Cap): Unit = {
abstract class A {
def foo(x: Int) = {
() => { ct.use(); io.use(); x }
}
}
class B extends A {
override def foo(x: Int) = {
() => { ct.use(); x }
}
}
}
Output
-- [E007] Type Mismatch Error: issues/method-inferred.scala:13:31 -----------------------------------------------------------------------------------------------------------------------------------------------
13 | override def foo(x: Int) = {
| ^
| Found: {ct} () -> Int
| Required: () -> Int
14 | () => { ct.use(); x }
15 | }
|
| longer explanation available when compiling with `-explain`
1 error found
Expectation
This code should compile.