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
Don't perform the apply rule optimization under boxing
This was already the case for the select rule optimization in recheckSelection
but was missing for the corresponding rule for applications.
This caused one regression in the standard library, here:
```
private def eagerHeadConcatIterators[A](it: Iterator[collection.Iterable[A]^]^): LazyListIterable[A]^{it} =
if !it.hasNext then Empty
else
eagerHeadPrependIterator
(it.next().iterator)
(eagerHeadConcatIterators(it))
```
Previously the access to `it.next()` was considered to have type `it` by applying the apply rule
incorrectly. It should be `it*`. This means we now have `it*` instead of `it` in the result type
and we also have an illegal use of `it*` leaking outside `eagerHeadConcatIterators`. The second
problem was fixed by adding an unsafe escape hatch `unsafeDiscardUses` that suppressed use recording.
This leads to:
```
private def eagerHeadConcatIterators[A](it: Iterator[collection.Iterable[A]^]^): LazyListIterable[A]^{it*} =
if !it.hasNext then Empty
else
eagerHeadPrependIterator
(caps.unsafe.unsafeDiscardUses(it.next()).iterator)
(eagerHeadConcatIterators(it))
```
This also did not compile since it claimed that the `it @reachCapability` was not a legal element of a capture set.
The root cause was that we forced some definitions already in parser, which can lead to confusion when compiling the
standard library itself. We now refrain from doing that and build the references to these annotations as untyped
trees all the way down.
0 commit comments