We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Nothing
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
main branch
main
It is modified from the test case pos-custom-args/captures/lazyref.scala.
pos-custom-args/captures/lazyref.scala
@annotation.capability class Cap class LazyRef[T](val elem: () => T): val get: {elem} () -> T = elem def map[U](f: T => U): {f, this} LazyRef[U] = new LazyRef(() => f(elem())) def map[A, B](ref: {*} LazyRef[A], f: A => B): {f, ref} LazyRef[B] = new LazyRef(() => f(ref.elem())) def main(io: Cap) = { def mapd[A, B]: ({io} LazyRef[A], A => B) => {*} LazyRef[B] = (ref1, f1) => map[A, B](ref1, f1) }
-- [E007] Type Mismatch Error: issues/lazymap-avoid.scala:13:4 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 13 | (ref1, f1) => map[A, B](ref1, f1) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | Found: ? (ref1: {io} Nothing, f1: ? (x$0: ? A) -> ? B) -> {f1, ref1, io} LazyRef[? >: ? B <: ? B]{elem: {*} () -> box ? B} | Required: ({io} LazyRef[A], A => B) => {io} LazyRef[B] | | longer explanation available when compiling with `-explain` 1 error found
It should compile.
Trace of the avoidance call in recheckBlock during rechecking:
recheckBlock
==> TypeOps.avoid(? (ref1: ? LazyRef[? A]{elem: ? () -> box ? A}, f1: ? (x$0: ? A) -> ? B) -> {f1, ref1} LazyRef[? B]{elem: {*} () -> box ? B}, [method $anonfun])? <== TypeOps.avoid(? (ref1: ? LazyRef[? A]{elem: ? () -> box ? A}, f1: ? (x$0: ? A) -> ? B) -> {f1, ref1} LazyRef[? B]{elem: {*} () -> box ? B}, [method $anonfun]) = ? (ref1: ? Nothing, f1: ? (x$0: ? A) -> ? B) -> {f1, ref1} LazyRef[? >: ? B <: ? B]{elem: {*} () -> box ? B}
As seen here, during avoidance, the capability argument type becomes Nothing.
The text was updated successfully, but these errors were encountered:
odersky
Successfully merging a pull request may close this issue.
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
main
branchMinimized code
It is modified from the test case
pos-custom-args/captures/lazyref.scala
.Output
Expectation
It should compile.
Trace of the avoidance call in
recheckBlock
during rechecking:As seen here, during avoidance, the capability argument type becomes
Nothing
.The text was updated successfully, but these errors were encountered: