Skip to content

Fix "REPL dependency on scala-parallel-collections doesn't work (in 3.8.2-RC1)"#25064

Merged
Gedochao merged 2 commits intoscala:mainfrom
lihaoyi:25058
Jan 23, 2026
Merged

Fix "REPL dependency on scala-parallel-collections doesn't work (in 3.8.2-RC1)"#25064
Gedochao merged 2 commits intoscala:mainfrom
lihaoyi:25058

Conversation

@lihaoyi
Copy link
Copy Markdown
Contributor

@lihaoyi lihaoyi commented Jan 22, 2026

Fixes #25058, vibe coded

Prompt:

Help me fix #25058.

  • Reproduce the problem locally manually or in the unit test harness
  • Analyze the code related to the problem and the git blame of that code to understand the history
  • Investigate the root cause using printlns and other debugging statements
  • Propose a theory for why the problem is happening
  • Implement a fix
  • Verify your fix using the unit tests
  • Review up your change by running git diff 3.8.2-RC1 and analyzing the diff to find unnecessary changes that can be
    cleaned up or areas where your implementation can be simplified or improved

Repeat as many times as necessary until the issue is fixed with an acceptable outcome

Almost one-shot by claude, except it initially jumped to coding a solution blind without testing, against my explicit instructions, which of course was wrong. After reminding it to reproduce the problem and write a test and make sure it's red/green, it came up with this PR

@lihaoyi
Copy link
Copy Markdown
Contributor Author

lihaoyi commented Jan 22, 2026

CC @bishabosha

// This allows libraries like scala-parallel-collections to work with :dep/:jar
val loader = new PackageLoader(packageVal, jarClasspath)
loader.enterClasses(packageClass, fullPackageName, flat = false)
loader.enterClasses(packageClass, fullPackageName, flat = true)
Copy link
Copy Markdown
Member

@bishabosha bishabosha Jan 22, 2026

Choose a reason for hiding this comment

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

Weird this is the same solution that GitHub copilot did and it didn't work - did you verify with sbt scala3-repl/run?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@bishabosha I think there are simply multiple bugs, and both claude and codex minimized to the same initial bug and stopped. I did some more vibing and the manual testing workflow seems to pass now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  1. Bug 1: For packages under scala.*, it completely skipped processing:
    else if packageClass.ownersIterator.contains(defn.ScalaPackageClass) then
    () // skip
  2. Bug 2: The code used if/else to process classes OR sub-packages, but not both:
    if jarClasspath.classes(fullPackageName).nonEmpty then
    // process classes
    else
    // process sub-packages

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Part of the issue was that printf ":dep org.scala-lang.modules::scala-parallel-collections:1.2.0\nprintln(123)\n" | sbt scala3-repl/run to run the REPL on a piece of input programmatically did not seem to work. If it did, claude could probably have figured it out without intervention. As is, claude had to add debug logs and ask me to run the REPL manually and paste it back the log output to figure things out

Copy link
Copy Markdown
Contributor

@Gedochao Gedochao left a comment

Choose a reason for hiding this comment

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

LGTM

@Gedochao Gedochao added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Jan 23, 2026
@Gedochao Gedochao added this to the 3.8.2 milestone Jan 23, 2026
@Gedochao Gedochao merged commit a3a3fb8 into scala:main Jan 23, 2026
56 checks passed
@bishabosha
Copy link
Copy Markdown
Member

bishabosha commented Jan 23, 2026

Edit: new issue #25078

This is actually still broken, as it crashes/fails to typecheck the moment you actually try to use a definition:

$ java -cp $(cs fetch -p org.scala-lang:scala3-repl_3:3.8.3-RC1-bin-SNAPSHOT) dotty.tools.repl.Main -cp $(cs fetch -p org.scala-lang:scala3-repl_3:3.8.3-RC1-bin-SNAPSHOT)

scala> :dep org.scala-lang.modules::scala-parallel-collections:1.2.0

scala> import scala.collection.parallel.CollectionConverters.seqIsParallelizable

scala> List(1,2,3).par
// crashes in TastyUnpickler
$ java -cp $(cs fetch -p org.scala-lang:scala3-repl_3:3.8.3-RC1-bin-SNAPSHOT) dotty.tools.repl.Main -cp $(cs fetch -p org.scala-lang:scala3-repl_3:3.8.3-RC1-bin-SNAPSHOT)

scala> :dep org.scala-lang.modules::scala-parallel-collections:1.2.0

scala> scala.collection.parallel.ParSeq(List(1,2,3)*)
-- Error: ----------------------------------------------------------------------
1 |scala.collection.parallel.ParSeq(List(1,2,3)*)
  |                                 ^^^^^^^^^^^^
  |Sequence argument type annotation `*` cannot be used here:
  |the corresponding parameter has type Seq[A] @Repeated which is not a repeated parameter type
1 error found

WojciechMazur pushed a commit that referenced this pull request Feb 4, 2026
….8.2-RC1)" (#25064)

Fixes #25058, vibe coded

Prompt:

> Help me fix #25058. 
> 
> - Reproduce the problem locally manually or in the unit test harness
> - Analyze the code related to the problem and the `git blame` of that
code to understand the history
> - Investigate the root cause using `println`s and other debugging
statements
> - Propose a theory for why the problem is happening
> - Implement a fix
> - Verify your fix using the unit tests
> - Review up your change by running `git diff 3.8.2-RC1` and analyzing
the diff to find unnecessary changes that can be
cleaned up or areas where your implementation can be simplified or
improved
> 
> Repeat as many times as necessary until the issue is fixed with an
acceptable outcome

_Almost_ one-shot by claude, except it initially jumped to coding a
solution blind without testing, against my explicit instructions, which
of course was wrong. After reminding it to reproduce the problem and
write a test and make sure it's red/green, it came up with this PR
[Cherry-picked a3a3fb8]
@WojciechMazur WojciechMazur added backport:accepted This PR needs to be backported, once it's been backported replace this tag by "backport:done" and removed backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. labels Feb 4, 2026
WojciechMazur added a commit that referenced this pull request Feb 5, 2026
…work (in 3.8.2-RC1)"" to 3.8.2 (#25191)

Backports #25064 to the 3.8.2-RC2.

PR submitted by the release tooling.
[skip ci]
@WojciechMazur WojciechMazur added backport:done This PR was successfully backported. and removed backport:accepted This PR needs to be backported, once it's been backported replace this tag by "backport:done" labels Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:done This PR was successfully backported.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REPL dependency on scala-parallel-collections doesn't work (in 3.8.2-RC1)

5 participants