Skip to content

Conversation

@WojciechMazur
Copy link
Contributor

Backports #24273 to the 3.8.0-RC4.

PR submitted by the release tooling.
[skip ci]

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.

[Cherry-picked 7bf957d]
@WojciechMazur WojciechMazur requested a review from a team as a code owner December 21, 2025 17:08
@WojciechMazur WojciechMazur force-pushed the release-3.8.0_backport-24273 branch from 88d4b7d to c0e4701 Compare December 21, 2025 17:33
@WojciechMazur WojciechMazur merged commit 9f4def9 into release-3.8.0 Dec 22, 2025
98 checks passed
@WojciechMazur WojciechMazur deleted the release-3.8.0_backport-24273 branch December 22, 2025 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants