Skip to content

Conversation

@WojciechMazur
Copy link
Contributor

Backports #24716 to the 3.8.0-RC4.

PR submitted by the release tooling.
[skip ci]

odersky and others added 3 commits December 21, 2025 18:08
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 force-pushed the release-3.8.0_backport-24709 branch from e7cb876 to 0d48002 Compare December 21, 2025 17:36
@WojciechMazur WojciechMazur force-pushed the release-3.8.0_backport-24716 branch from 0c8f32e to 3b1e506 Compare December 21, 2025 17:37
WojciechMazur and others added 3 commits December 21, 2025 19:13
…s with unresolved `org.scala-lang/scala-reflect/3.8.0-RC3-bin-SNAPSHOT` (no such problem on main)
@WojciechMazur WojciechMazur force-pushed the release-3.8.0_backport-24716 branch from 3b1e506 to f830c10 Compare December 21, 2025 18:19
Base automatically changed from release-3.8.0_backport-24709 to release-3.8.0 December 22, 2025 10:54
@WojciechMazur WojciechMazur requested a review from a team as a code owner December 22, 2025 10:54
@WojciechMazur WojciechMazur merged commit 66bfc9c into release-3.8.0 Dec 22, 2025
49 checks passed
@WojciechMazur WojciechMazur deleted the release-3.8.0_backport-24716 branch December 22, 2025 10:54
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.

5 participants