Skip to content

Remove test warning suppressions, fix all resulting warnings#14

Open
halotukozak wants to merge 6 commits intoseries/3.x-avsfrom
disable-nowarns
Open

Remove test warning suppressions, fix all resulting warnings#14
halotukozak wants to merge 6 commits intoseries/3.x-avsfrom
disable-nowarns

Conversation

@halotukozak
Copy link
Copy Markdown
Member

Summary

  • Remove Test / scalacOptions --= that suppressed -Wunused:patvars and -Xlint:constant in tests
  • Remove Scala 3 -Werror blanket disable
  • Fix all resulting compiler warnings in source and test code:
    • Add : Unit type ascriptions to discard-value expressions (conn.pop(), p.trySuccess(), cursor.next(), future.get(), pf(r), buffer.offer())
    • Add : @unchecked to irrefutable pattern matches (val Some(...) = ..., val x :: xs = ..., val CompositeException(...) = ...)
    • Replace unused for-loop variables (for (i <-) with wildcards (for (_ <-) across 12 test files
    • Replace Long.MaxValue + 1 constant overflow with Long.MinValue equivalent

Note: 4 thread.getId deprecation warnings remain — these will be addressed separately.

Test plan

  • sbt +test passes for all modules except executionJVM/Compile (pre-existing getId deprecation)
  • Verify no behavioral changes in overflow-related OrderedCancelableSuite tests

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 27, 2026 13:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens compiler hygiene by removing test-only warning suppressions and re-enabling Scala 3 “fatal warnings” behavior, then updating production and test code to compile cleanly under stricter warning settings.

Changes:

  • Removed Test / scalacOptions --= suppressions for -Wunused:patvars and -Xlint:constant, and removed the Scala 3 -Werror exclusion in build.sbt.
  • Updated code to explicitly discard values (: Unit) where results are intentionally ignored, and silenced irrefutable-pattern warnings (: @unchecked) where intended.
  • Cleaned up tests to avoid unused loop variables and replaced constant-overflow expressions with equivalent non-overflowing literals.

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
monix-tail/shared/src/main/scala/monix/tail/internal/IterantTakeLast.scala Discard buffer.offer results explicitly to satisfy non-Unit statement warnings.
monix-tail/shared/src/main/scala/monix/tail/internal/IterantCompleteL.scala Discard cursor.next() results explicitly during cursor draining.
monix-reactive/shared/src/test/scala/monix/reactive/subjects/ReplaySubjectSuite.scala Replace unused loop variable with wildcard in subscription loops.
monix-reactive/shared/src/test/scala/monix/reactive/subjects/PublishSubjectSuite.scala Replace unused loop variable with wildcard in subscription loops.
monix-reactive/shared/src/test/scala/monix/reactive/subjects/ProfunctorSubjectSuite.scala Replace unused loop variable with wildcard in subscription loops.
monix-reactive/shared/src/test/scala/monix/reactive/subjects/BehaviorSubjectSuite.scala Replace unused loop variable with wildcard in subscription loops.
monix-reactive/shared/src/test/scala/monix/reactive/internal/rstreams/MonixSubscriberAsReactiveSuite.scala Replace unused loop variable with wildcard in stress loop.
monix-reactive/shared/src/test/scala/monix/reactive/internal/operators/BufferIntrospectiveSuite.scala Replace unused loop variable with wildcard in repeated onNext loop.
monix-execution/shared/src/test/scala/monix/execution/schedulers/ExecutionModelSuite.scala Replace unused loop variable with wildcard in frame-advance loop.
monix-execution/shared/src/test/scala/monix/execution/cancelables/OrderedCancelableSuite.scala Replace constant-overflow expressions with equivalent Long.MinValue values.
monix-execution/shared/src/test/scala/monix/execution/CancelableSuite.scala Add : @unchecked to suppress irrefutable-pattern warnings in tests.
monix-execution/shared/src/main/scala/monix/execution/CancelablePromise.scala Add : @unchecked to suppress irrefutable-pattern warning when destructuring a non-empty list.
monix-execution/shared/src/main/scala/monix/execution/CancelableFuture.scala Discard pf(r) result explicitly in andThen.
monix-execution/shared/src/main/scala/monix/execution/Ack.scala Discard Promise.trySuccess boolean result explicitly.
monix-execution/jvm/src/test/scala/monix/execution/atomic/ConcurrentAtomicSuite.scala Replace unused loop variables with wildcards in concurrent tests.
monix-execution/jvm/src/test/scala/monix/execution/atomic/ConcurrentAtomicNumberSuite.scala Replace unused loop variables with wildcards in concurrent tests.
monix-execution/jvm/src/main/scala/monix/execution/schedulers/AdaptedThreadPoolExecutor.scala Discard future.get() result explicitly in afterExecute.
monix-eval/shared/src/test/scala/monix/eval/TaskMemoizeOnSuccessSuite.scala Replace unused loop variables with wildcards in stack-safety loops.
monix-eval/shared/src/test/scala/monix/eval/TaskExecuteWithOptionsSuite.scala Add : @unchecked to suppress irrefutable-pattern warning when destructuring f.value.
monix-eval/shared/src/main/scala/monix/eval/internal/TaskFromFuture.scala Discard conn.pop() result explicitly.
monix-eval/shared/src/main/scala/monix/eval/internal/TaskCreate.scala Discard ctx.connection.pop() result explicitly.
monix-eval/shared/src/main/scala/monix/eval/internal/TaskConversions.scala Discard conn.pop() result explicitly.
build.sbt Removes test warning suppressions and the Scala 3 -Werror exclusion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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