Skip to content

Migrate to Scala 3.9.0 LTS - #525

Open
pierscin wants to merge 6 commits into
masterfrom
scala-3-9-migration
Open

pierscin wants to merge 6 commits into
masterfrom
scala-3-9-migration

Conversation

@pierscin

@pierscin pierscin commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Needs scala 3.9+ - probably needs new minor version

pierscin and others added 6 commits October 6, 2026 10:13
- scalaVersion 3.3.8 -> 3.9.0; Scala Steward pin 3.3. -> 3.9.
- drop -Yfuture-lazy-vals: rejected by 3.9 ("bad option"), VarHandle-based
  lazy vals are the default since 3.8
- KafkaStage: pass the SortedSet ordering with `using` (3.9 no longer
  accepts an explicit argument list for the implicit parameter there)
- resource.scala: with 3.9, the NoEnclosingConcurrencyScope given is emitted
  returning void, so the BoxedUnit version (linked by code compiled with
  3.3) is now provided explicitly via @TargetNAME; keeps MiMa green
  (scala/scala3#24653)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- `_` type wildcards -> `?`, `xs: _*` -> `xs*`, `= _` -> `= uninitialized`
- remove unused imports/params/pattern vars reported by the new unused checker
  (`@unused` where the parameter is part of the public API)
- remove a written-but-never-read `successCalls` counter in CircuitBreakerStateMachine
- `@unchecked` type tests for local classes in flattenPar / groupBy (TODO(scala-3.9))

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pierscin
pierscin marked this pull request as ready for review October 9, 2026 07:10
@pierscin
pierscin requested a review from adamw October 9, 2026 09:06

case FromParent(t) =>
// safe: these values never leave this invocation
case fp: FromParent @unchecked =>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hm that's suspicious. Isn't the pool typed with a union type, which should make this work?

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.

New check:

[E092] Pattern Match Unchecked Warning: groupByImpl.scala:150:15
  case FromParent(t) =>
  the type test for FromParent cannot be checked at runtime because it's a local class

@adamw adamw Oct 9, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hm so maybe it should be a private top-level class? or maybe the match can be expressed differently ... it is a proper type, so matching on it should be possible


case Nested(t) =>
// safe: these values never leave this invocation
case n: Nested @unchecked =>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here ... this shouldn't be unchecked

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.

As above:

[E092] Pattern Match Unchecked Warning: FlowOps.scala:660:15
  case Nested(t) =>
  the type test for Nested cannot be checked at runtime because it's a local class

def empty[A]: Chunk[A] = Empty

def fromArray[A: ClassTag](array: Array[A]): Chunk[A] =
def fromArray[A](array: Array[A])(using @unused ct: ClassTag[A]): Chunk[A] =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what's the deault with an unused using? ;) it's needed for creating the array?

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.

[warn] -- [E198] Unused Symbol Warning: .../ox/core/src/main/scala/ox/Chunk.scala:188:42
[warn] 188 |  def fromArray[A](array: Array[A])(using ct: ClassTag[A]): Chunk[A] =
[warn]     |                                          ^^
[warn]     |                                          unused implicit parameter
[warn] -- [E198] Unused Symbol Warning: .../ox/core/src/main/scala/ox/Chunk.scala:191:44
[warn] 191 |  def fromIArray[A](array: IArray[A])(using ct: ClassTag[A]): Chunk[A] =
[warn]     |                                            ^^
[warn]     |                                            unused implicit parameter
[success] elapsed time: 9 s

This parameter was not needed, so after update to 3.9 it was reported as unused but deleting it triggered MiMa.

[error] core: Failed binary compatibility check against com.softwaremill.ox:core_3:1.0.9! Found 2 potential problems (filtered 38)
[error]  * method fromArray(java.lang.Object,scala.reflect.ClassTag)ox.Chunk in object ox.Chunk does not have a correspondent in current version
[error]  * method fromIArray(java.lang.Object,scala.reflect.ClassTag)ox.Chunk in object ox.Chunk does not have a correspondent in current version
[error] To accept the incompatible changes above, add the lines below to mimaBinaryIssueFilters, or to src/main/mima-filters/<version>.backwards.excludes.
[error]    ProblemFilters.exclude[DirectMissingMethodProblem]("ox.Chunk.fromArray(java.lang.Object,scala.reflect.ClassTag)ox.Chunk"),
[error]    ProblemFilters.exclude[DirectMissingMethodProblem]("ox.Chunk.fromIArray(java.lang.Object,scala.reflect.ClassTag)ox.Chunk"),
[error] (core / mimaReportBinaryIssues) Failed binary compatibility check against com.softwaremill.ox:core_3:1.0.9! Found 2 potential problems (filtered 38)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah ok. Then adding a comment why it's there would be useful :)

case given boundary.Label[Either[E, Nothing]] =>
break(t.asInstanceOf[Either[E, Nothing]])
case given boundary.Label[Either[Nothing, Nothing]] =>
case _: boundary.Label[Either[Nothing, Nothing]] =>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why the change here? the given works above, but not in the second clause?

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.

It was reported as unused after updating to 3.9.

[warn] -- [E198] Unused Symbol Warning: .../ox/core/src/main/scala/ox/either.scala:80:13
[warn] 80 |        case given boundary.Label[Either[Nothing, Nothing]] =>
[warn]    |             ^^^^^^^^^^^^^^^^^^
[warn]    |             unused pattern variable

So the change didn't really change anything outside of warning.

@pierscin
pierscin requested a review from adamw October 9, 2026 13:26
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.

2 participants