-
Notifications
You must be signed in to change notification settings - Fork 50
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
Conversation
…into pr/settings-refresh
val old = scalacOptions.value | ||
val flag = "-Xfatal-warnings" | ||
if (tlFatalWarnings.value) | ||
if (!old.contains(flag)) old :+ flag else old | ||
else | ||
old.filterNot(_ == flag) |
There was a problem hiding this comment.
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")
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?
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).
-source:3.2-migration
#474tlFatalWarnings
andtlJdkRelease
don't respectConfig
,Test
, etc. scopes #257