Skip to content

Conversation

@WojciechMazur
Copy link
Contributor

No description provided.

@hamzaremmal
Copy link
Member

hamzaremmal commented Sep 26, 2025

Looks like 3.7.4-RC1 is DOA.

@WojciechMazur
Copy link
Contributor Author

Minimalization of the issue, we'll release an RC2 next week with fix for this issue - we'll revert the problematic PR

package scala
package test

import scala.language.`2.13`
import language.experimental.captureChecking

trait IterableOnce[+A] { this: IterableOnce[A]^ =>
  def iterator: Iterator[A]^{this}
}

class SortedMap[K, +V] extends IterableOnce[(K, V)]:
  def iterator: Iterator[(K, V)]^{this} = ???

final class TreeMap[K, +V]
object TreeMap:
  def fromOrderedEntries[A, B](xs: Iterator[(A, B)]): TreeMap[A, B] = ???
  def from[K, V](it: IterableOnce[(K, V)]^): TreeMap[K, V] =
    it match
      case sm: SortedMap[K, V]  =>
        fromOrderedEntries(sm.iterator)
        ???

@WojciechMazur
Copy link
Contributor Author

Bisect pointed to d04f4b5 / #23982
@noti0na1 can you confirm it works as expected before we'll start reverting that for RC2?

@noti0na1
Copy link
Member

I will take a look

@noti0na1
Copy link
Member

The errors look legit to me.

Take immutable.TreeSet.from as an example, the parameter is tracked: it: IterableOnce[E]^. After pattern match, ss should be SortedSet[E]^{it}. Calling iterator will return an Interator^{ss}, which is tracked as well. However, fromOrderedKeys only accepts non-tracked Interator, and causes error.

The correct fix would be updating fromOrderedKeys and fromOrderedEntries.

I don't understand why the errors were not caught during scala-library-bootstrapped on nightly?

@noti0na1
Copy link
Member

The errors should be solved after #24085

noti0na1 added a commit that referenced this pull request Sep 26, 2025
…24085)

Fix errors in #24081

Take `immutable.TreeSet.from` as an example, the parameter is tracked: `it: IterableOnce[E]^`. After pattern match, `ss` should be `SortedSet[E]^{it}`. Calling `iterator` will return an `Interator^{ss}`, which is tracked as well. However, `fromOrderedKeys` only accepts non-tracked `Interator`, and causes error.

The fix updates`fromOrderedKeys` and `fromOrderedEntries`.
@WojciechMazur
Copy link
Contributor Author

Thank you @noti0na1 ! Seems like we don't need to hurry with RC2, @hamzaremmal non bootstrapped tests can be restored as soon as this PR is merged

@WojciechMazur WojciechMazur merged commit a4e1309 into scala:main Sep 26, 2025
49 checks passed
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