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
Fixes#23421.
This PR includes the following two changes:
1. In `capToFresh`, turn `cap`s in invariant occurrences also to
`Fresh`es. Previously, in the follow code:
```
val xs: ArrayBuffer[() ->{cap} Unit] = ...
```
The `cap` is kept intact since it is invariant. Now, it gets converted
into a `Fresh` owned by `xs`.
2. In `toResultInResults`, convert fresh caps of `def`-method with only
type parameters into result caps, just like parameterless defs.
Specifically, for the following code:
```
def empty[T]: ArrayBuffer[T]^ = ...
```
The `^` will be turned into a result cap, just like what happens for a
parameterless def:
```
def mkRef: Ref^ = ...
```
The `^` is a result cap that gets instantiated to a new fresh at each
application of `mkRef`. Doing the same thing for `empty` is the arguably
more desirable behavior.
0 commit comments