Skip to content

Migrate to Scala 3.9.0 LTS - #525

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

pierscin wants to merge 9 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

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.

I'll try to make something readable, but there are 2 problems:

  1. Inner class with T is shared across JVM and T is erased. It was a bug Pattern matching on a local class is unsound, should emit an unchecked warning scala/scala3#4812
  2. We can't see method's T when we define class outside of it and when we define it with a type parameter matching on U | FromParent[T] and U can be FromParent[X] for compiler

If it will be worse then we can revert it.


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

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.

similar to above

Comment thread core/src/main/scala/ox/Chunk.scala
Comment thread core/src/main/scala/ox/either.scala
@pierscin
pierscin requested a review from adamw October 9, 2026 13:26
pierscin and others added 3 commits October 12, 2026 10:27
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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