You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the closure has an expected function type with a fully defined result type,
take the internalized result type as the local return type of the closure.
This has the effect that some conformance tests are now done with Fresh instead Result
caps. This means a now can widen a local reference to a result cap, since the comparison
is done between the local reference and the internalized FreshCap. Previously this failed
since we compared a local cap with result cap, and result caps only subtype other result caps.
It also propagates types more aggressively into closure bodies, which sometimes reduces the
error span and improves the error message.
Copy file name to clipboardExpand all lines: tests/neg-custom-args/captures/filevar.check
+3-4Lines changed: 3 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,10 @@
1
1
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/filevar.scala:15:12 --------------------------------------
2
2
15 | withFile: f => // error with level checking, was OK under both schemes before
3
3
| ^
4
-
|Found: (l: scala.caps.Capability^) ?->? File^? ->? Unit
5
-
|Required: (l: scala.caps.Capability^) ?-> (f: File^{l}) => Unit
4
+
|Found: (f: File^?) ->? Unit
5
+
|Required: (f: File^{l}) => Unit
6
6
|
7
-
|where: => refers to a root capability associated with the result type of (using l: scala.caps.Capability^): (f: File^{l}) => Unit
8
-
| ^ refers to the universal root capability
7
+
|where: => refers to a fresh root capability created in anonymous function of type (using l²: scala.caps.Capability): File^{l²} -> Unit when instantiating expected result type (f: File^{l}) ->{cap} Unit of function literal
9
8
|
10
9
|Note that capability l.type
11
10
|cannot be included in outer capture set ? of parameter f.
0 commit comments