-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give some explanation of a capture set was under-approximated
- Loading branch information
Showing
7 changed files
with
79 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/class-contra.scala:12:39 --------------------------------- | ||
12 | def fun(x: K{val f: T^{a}}) = x.setf(a) // error | ||
| ^ | ||
| Found: (a : T^{x, y}) | ||
| Required: T | ||
| Found: (a : T^{x, y}) | ||
| Required: T^{} | ||
| | ||
| Note that a capability (K.this.f : T^) in a capture set appearing in contravariant position | ||
| was mapped to (x.f : T^{a}) which is not a capability. Therefore, it was under-approximated to the empty set. | ||
| | ||
| longer explanation available when compiling with `-explain` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/explain-under-approx.scala:12:10 ------------------------- | ||
12 | col.add(Future(() => 25)) // error | ||
| ^^^^^^^^^^^^^^^^ | ||
| Found: Future[Int]{val a: (async : Async^)}^{async} | ||
| Required: Future[Int]^{} | ||
| | ||
| Note that a capability Collector.this.futs* in a capture set appearing in contravariant position | ||
| was mapped to col.futs* which is not a capability. Therefore, it was under-approximated to the empty set. | ||
| | ||
| longer explanation available when compiling with `-explain` | ||
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/explain-under-approx.scala:15:11 ------------------------- | ||
15 | col1.add(Future(() => 25)) // error | ||
| ^^^^^^^^^^^^^^^^ | ||
| Found: Future[Int]{val a: (async : Async^)}^{async} | ||
| Required: Future[Int]^{} | ||
| | ||
| Note that a capability Collector.this.futs* in a capture set appearing in contravariant position | ||
| was mapped to col1.futs* which is not a capability. Therefore, it was under-approximated to the empty set. | ||
| | ||
| longer explanation available when compiling with `-explain` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
trait Async extends caps.Capability | ||
|
||
class Future[+T](x: () => T)(using val a: Async) | ||
|
||
class Collector[T](val futs: Seq[Future[T]^]): | ||
def add(fut: Future[T]^{futs*}) = ??? | ||
|
||
def main() = | ||
given async: Async = ??? | ||
val futs = (1 to 20).map(x => Future(() => x)) | ||
val col = Collector(futs) | ||
col.add(Future(() => 25)) // error | ||
val col1: Collector[Int] { val futs: Seq[Future[Int]^{async}] } | ||
= Collector(futs) | ||
col1.add(Future(() => 25)) // error | ||
|
||
|