Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Typelevel scalac options #458

Closed
wants to merge 6 commits into from
Closed

Conversation

steinybot
Copy link
Collaborator

I was working on #390 which adds a few different projects for the code gen and configuring the different options for the different scala versions was a pain. This makes it a fair bit easier and removes some of the existing workarounds.

I didn't go as far as adding https://github.com/typelevel/sbt-tpolecat although that would be my preference.

I "fixed" (ignored) a few warnings which possibly started showing up as I didn't remove as many warnings for the projects with Scala 2.12.

There are still 2 left:

[warn] -- Warning: /Users/jason/src/kyo2/kyo-stats-registry/js/src/main/scala/kyo/stats/internal/UnsafeHistogram.scala:3:22
[warn] 3 |class UnsafeHistogram(numberOfSignificantValueDigits: Int, highestToLowestValueRatio: Long) {
[warn]   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[warn]   |                      unused explicit parameter
[warn] -- Warning: /Users/jason/src/kyo2/kyo-stats-registry/js/src/main/scala/kyo/stats/internal/UnsafeHistogram.scala:3:59
[warn] 3 |class UnsafeHistogram(numberOfSignificantValueDigits: Int, highestToLowestValueRatio: Long) {
[warn]   |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^
[warn]   |                                                 unused explicit parameter

statsScope.scope("clock").gauge("skew")((System.currentTimeMillis() - millis).toDouble)
locally {
val _ =
statsScope.scope("clock").gauge("skew")((System.currentTimeMillis() - millis).toDouble)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I couldn't use the @unused annotation because it isn't available in Scala 2.12. You are supposed to be able to annotate with : Unit to avoid discarded non-unit value warnings but I have very little success using that approach. Perhaps UnsafeGuage should have a void method or there should be another gauge method that returns Unit?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Metrics are held via weak references in kyo-stats-registry so we need the class field holding the gauge reference to avoid it getting garbage collected. Maybe we could move kyo.discard to kyo-scheduler?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved discard to kyo-scheduler but it is using Scala 3 top level function definitions and so isn't going to work. I'll have to come up with something else.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok scratch that. You already removed the -Wunused:all option so this is now a non-issue.

@steinybot
Copy link
Collaborator Author

Scrapping this in favor of #485

@steinybot steinybot closed this Jun 13, 2024
@steinybot steinybot deleted the scalac-options branch June 13, 2024 11:32
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