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

Refresh scalac settings #531

Merged
merged 9 commits into from
Jun 18, 2023
Merged

Refresh scalac settings #531

merged 9 commits into from
Jun 18, 2023

Conversation

@mergify mergify bot added the settings label Jun 18, 2023
Comment on lines 271 to 276
val old = scalacOptions.value
val flag = "-Xfatal-warnings"
if (tlFatalWarnings.value)
if (!old.contains(flag)) old :+ flag else old
else
old.filterNot(_ == flag)
Copy link
Contributor

Choose a reason for hiding this comment

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

A minor nit: -Xfatal-warnings was superseded with -Werror on 2.13 and 3.x. Although the former seems still working on both compilers.

However, perhaps it makes sense to check for both options in the if condition, like

if (!old.contains(flag) && !old.contains("-Werror")) old :+ flag else old
else
  old.filterNot(opt => opt == flag || opt == "-Werror")

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, good to know 🤔 do you know which Scala versions that happened in?

I'm kind of okay with sbt-typelevel dropping support for old patches.

Copy link
Member Author

Choose a reason for hiding this comment

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

However, perhaps it makes sense to check for both options in the if condition, like

The if is mainly intended to check for the flag it added itself, since Test seems to inherit from Compile, see #255 (comment).

Copy link
Contributor

Choose a reason for hiding this comment

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

@armanbilge

Oh, good to know 🤔 do you know which Scala versions that happened in?

looks like -Werror was added since 2.12.17:

$ scala-cli compile --server=false -S 2.12.16 -Werror -Xlint -- UnusedImport.scala 
scalac error: bad option: '-Werror'
  scalac -help  gives more information
Compilation failed

$ scala-cli compile --server=false -S 2.12.17 -Werror -Xlint -- UnusedImport.scala 
UnusedImport.scala:1: warning: Unused import
import scala.concurrent.Future
                        ^
error: No warnings can be incurred under -Xfatal-warnings.
one warning found
one error found
Compilation failed

However, seems it was not announced officially: https://github.com/scala/scala/releases/tag/v2.12.17.
Neither it is returned by any of scalac v2.12.17 help options (I couldn't find any at least).

@armanbilge armanbilge merged commit daa3307 into main Jun 18, 2023
@armanbilge armanbilge deleted the pr/settings-refresh branch June 18, 2023 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restore -source:3.2-migration tlFatalWarnings and tlJdkRelease don't respect Config, Test, etc. scopes
4 participants