Skip to content

Add missing & caps.Pure bounds to the ClassTagSeqFactory family#26224

Open
bvenners wants to merge 1 commit into
scala:mainfrom
artimahub:fix-classtag-seqfactory-caps-pure
Open

Add missing & caps.Pure bounds to the ClassTagSeqFactory family#26224
bvenners wants to merge 1 commit into
scala:mainfrom
artimahub:fix-classtag-seqfactory-caps-pure

Conversation

@bvenners
Copy link
Copy Markdown
Contributor

@bvenners bvenners commented Jun 3, 2026

What

Adds & caps.Pure to the CC upper bounds of three declarations in
library/src/scala/collection/Factory.scala:

  • trait ClassTagSeqFactory
  • class ClassTagSeqFactory.Delegate
  • trait StrictOptimizedClassTagSeqFactory

This brings them in line with their non-ClassTag counterparts, which
already carry the bound:

  • SeqFactory, SeqFactory.Delegate, StrictOptimizedSeqFactory
  • ClassTagSeqFactory.AnySeqDelegate

Why

Factory.scala is compiled with import language.experimental.captureChecking.
When the capture-checked collections were ported in #23769, the & caps.Pure
bound was added to the SeqFactory family and to AnySeqDelegate, but the
parallel ClassTagSeqFactory family was left without it. The inconsistency was
latent until the purity checks were tightened in #26085 ("Tighten check of field
classifiers") and #26097 ("Don't assume classes with self aliases to be pure").
The companion stdlib patch in #26097 (commit 8748bb9, "Fix stdlib") covered other
spots but missed this family.

With the tightened checker, recompiling the capture-checked stdlib now fails on
these three declarations because their CC parameter is passed to a context that
requires ... & caps.Pure.

How to reproduce

sbt scala3-bootstrapped/testCompilation

fails before this change and passes after it.

Notes

Pure type-bound consistency fix; no behavioral change.

Copy link
Copy Markdown
Contributor

@natsukagami natsukagami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense. Thanks!

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