Add scala-parser-combinators dependency - #63
Merged
Conversation
bin/run.sh compiles a solution against the assembly jar only and never
reads the exercise's own build.sbt, so a library an exercise needs has to
be part of this project's dependencies (as monocle already is for
LensPerson).
The sgf-parsing stub imports scala.util.parsing.combinator.RegexParsers,
which has not been in the standard library since Scala 2.13. Since the
track moved to Scala 3 the exercise therefore fails to compile online
even when the student has not touched it:
-- [E008] Not Found Error: src/main/scala/Sgf.scala:1:18
1 |import scala.util.parsing.combinator.RegexParsers
| ^^^^^^^^^^^^^^^^^^
| value parsing is not a member of util
alphametics, forth, matching-brackets and wordy declare the same
dependency for their example solutions, so they are covered too.
Version 2.4.0 matches the one the track's own root build.sbt uses.
Adds a tests/example-sgf-parsing fixture so a missing parser-combinators
dependency fails the test suite instead of only surfacing in production.
Fixes exercism/scala#863
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
IsaacG
approved these changes
Aug 27, 2026
IsaacG
reviewed
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
注册 for free
to join this conversation on GitHub.
Already have an account?
登录 to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes exercism/scala#863.
The problem
bin/run.shcompiles a student's solution against the assembly jar and nothing else:The exercise's own
build.sbtis never read, so a library an exercise needs has to be one of this project's dependencies — which is whymonocleis already here for LensPerson.scala-parser-combinatorswas not. Thesgf-parsingstub importsscala.util.parsing.combinator.RegexParsers, and that package left the standard library in Scala 2.13. So since the track moved to Scala 3 in exercism/scala#836,sgf-parsinghas failed to compile online even for a student who has not edited the stub at all:Locally the exercise works, because there
sbtdoes read itsbuild.sbt— which is why this only ever showed up as a report from the website.The change
Adds
scala-parser-combinatorsoutside theTestscope sosbt assemblyputs it in the fat jar, following the existing comment on that block.Version
2.4.0is the current release and the one the track's own rootbuild.sbtalready uses. Four more exercises —alphametics,forth,matching-bracketsandwordy— declare the same dependency for their example solutions, so they are covered by the same change.Verification
Reconstructing the old classpath (scalatest, scalacheck, org.json, monocle — 28 jars, no parser-combinators) and compiling the untouched
sgf-parsingstub with Scala 3.4.2 reproduces the[E008]error above. Against the newly assembled jar the same files compile clean.bin/run-tests-in-docker.shpasses, all 10 fixtures:新建 fixture
tests/example-sgf-parsingis a trimmed parser-combinator solution with six tests, mirroring howexample-lens-personguards themonocledependency. Without the dependency this fixture fails to compile, so a regression is caught by CI rather than by a student.Note:
sbt testreports 2 pre-existing failures inApplicationSpec(testResultsFiles is null,Application.scala:76). They fail identically onmainand are unrelated to this change.关注-up, not in this PR
The five exercises in
exercism/scalapinscala-parser-combinatorsat2.1.0in their ownbuild.sbt, so local runs resolve 2.1.0 while the runner now provides 2.4.0. Harmless forRegexParsers, but worth aligning in a track-side PR.