Fix "REPL dependency on scala-parallel-collections doesn't work (in 3.8.2-RC1)"#25064
Fix "REPL dependency on scala-parallel-collections doesn't work (in 3.8.2-RC1)"#25064Gedochao merged 2 commits intoscala:mainfrom
Conversation
|
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) |
There was a problem hiding this comment.
Weird this is the same solution that GitHub copilot did and it didn't work - did you verify with sbt scala3-repl/run?
There was a problem hiding this comment.
@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
There was a problem hiding this comment.
- Bug 1: For packages under scala.*, it completely skipped processing:
else if packageClass.ownersIterator.contains(defn.ScalaPackageClass) then
() // skip- 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
There was a problem hiding this comment.
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
|
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 |
….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]
Fixes #25058, vibe coded
Prompt:
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