From 58549596db6f1dd4714c44855a8d5fa978b17251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Rochala?= <48657087+rochala@users.noreply.github.com> Date: Tue, 7 May 2024 14:30:29 +0200 Subject: [PATCH] Lift Scala Settings from experimental to stabilized (#20199) Fixes: https://github.com/scala/scala3/issues/19693 This is the tracking list from the issue and the status of migraton. - [x] lift to `-X` - [x] `-Yresolve-term-conflict` - [x] `-YnoGenericSig` - [x] `-Ydumpclasses` - [x] `-YjarCompressionLevel` - [x] `-YkindProjector` - [x] `-YdropComments` - [x] `-YcookComments` - [x] `-YreadComments` - [x] `-YnoDecodeStacktraces` - [x] `-YnoEnrichErrorMessages` - [x] `-YdebugMacros` - [ ] `-YjavaTasty`- deprecate in 3.7.0 - [ ] `-YjavaTastyOutput`- deprecate in 3.7.0 - [ ] `-YallowOutlineFromTasty`- deprecate in 3.7.0 - [x] lift to `-W` - [x] `-Wsafe-init` - [x] to be removed - [x] `--Yforce-inline-while-typing` // Note: this was already removed by https://github.com/scala/scala3/commit/05eb7f7ae514d1db5e0bece30d63cf5a30164ee8 - [ ] TBD - [ ] `-YfromTastyIgnoreList` // this flag was not decided - [x] `-YoutputOnlyTasty` I suppose 2 last flags that have to be decided are maintained by @bishabosha Do you know their status ? Other than that, this PR implemented a deprecation mechanism for the future e.g. ```scala Deprecation( msg = "message", replacedBy = Some("newMessage"), ) ``` EDIT: As it was decided, options responsible for pipelining will be retained until 3.7.0. The code is commented and following PR which will deprecate them will be created after merging this one. EDIT2: `-Xlint` is a very problematic flag. It was added into the compiler in 3.4 bypassing argument verification. Then in the future, when it was deprecated in favour of `-Wshadow` we couldn't exactly map them 1-1, and it was deprecated in following way: - Scala 2: `-Xlint` is valid flag, - Scala pre 3.4: `-Xlint` was skipped as it was not implemented, - Scala post 3.4 pre flag refactor: `-Xlint` was implemented allowing for `all`, `private-shadow` and `type-parameter-shadow` options. It also bypassed argument verification allowing standalone `-Xlint` to be ignored, not reported as error, - Scala post 3.4 post flag refactor: This flag was then deprecated in favour of `-Wshadow`. We didn't want to commit this mistake again and allow standalone `-Wshadow` thus when it was deprecated, we didn't handle it as we should (deprecated option should trigger replacement when possible). That's why I'm retaining the previous behaviour of `-Xlint`. It will be removed in the future versions as it is already deprecated. --- community-build/community-projects/AsyncFile | 2 +- community-build/community-projects/Equal | 2 +- community-build/community-projects/FingerTree | 2 +- community-build/community-projects/Log | 2 +- community-build/community-projects/Lucre | 2 +- community-build/community-projects/Model | 2 +- community-build/community-projects/Numbers | 2 +- community-build/community-projects/Serial | 2 +- community-build/community-projects/Span | 2 +- community-build/community-projects/discipline | 2 +- .../community-projects/discipline-munit | 2 +- .../community-projects/discipline-specs2 | 2 +- community-build/community-projects/fs2 | 2 +- community-build/community-projects/scala-stm | 2 +- community-build/community-projects/scodec | 2 +- community-build/community-projects/verify | 2 +- .../scala/dotty/communitybuild/projects.scala | 19 +- .../tools/backend/jvm/BCodeHelpers.scala | 2 +- .../jvm/PostProcessorFrontendAccess.scala | 6 +- compiler/src/dotty/tools/dotc/Driver.scala | 2 +- compiler/src/dotty/tools/dotc/Run.scala | 2 +- .../dotty/tools/dotc/config/CliCommand.scala | 3 +- .../tools/dotc/config/ScalaSettings.scala | 85 +++++-- .../dotty/tools/dotc/config/Settings.scala | 238 ++++++++++-------- .../src/dotty/tools/dotc/core/Phases.scala | 6 +- .../dotty/tools/dotc/core/SymbolLoaders.scala | 6 +- .../src/dotty/tools/dotc/core/Symbols.scala | 2 +- .../dotty/tools/dotc/core/TypeErrors.scala | 4 +- .../tools/dotc/core/tasty/TreePickler.scala | 4 +- .../tools/dotc/core/tasty/TreeUnpickler.scala | 4 +- .../dotc/decompiler/IDEDecompilerDriver.scala | 2 +- .../tools/dotc/fromtasty/ReadTasty.scala | 8 +- .../dotc/interactive/InteractiveDriver.scala | 4 +- .../dotty/tools/dotc/parsing/Parsers.scala | 14 +- .../dotty/tools/dotc/parsing/Scanners.scala | 2 +- compiler/src/dotty/tools/dotc/report.scala | 4 +- .../src/dotty/tools/dotc/sbt/ExtractAPI.scala | 8 +- .../tools/dotc/sbt/ExtractDependencies.scala | 2 +- .../tools/dotc/transform/CookComments.scala | 2 +- .../dotc/transform/GenericSignatures.scala | 2 +- .../dotty/tools/dotc/transform/Pickler.scala | 12 +- .../tools/dotc/transform/init/Checker.scala | 4 +- .../dotty/tools/dotc/typer/TyperPhase.scala | 2 +- compiler/src/dotty/tools/io/FileWriters.scala | 2 +- .../src/dotty/tools/repl/ReplDriver.scala | 4 +- .../quoted/runtime/impl/QuotesImpl.scala | 2 +- .../dotty/tools/dotc/CompilationTests.scala | 18 +- .../test/dotty/tools/dotc/SettingsTests.scala | 128 +++++++++- .../dotc/config/ScalaSettingsTests.scala | 101 ++++++++ .../dotc/core/tasty/CommentPicklingTest.scala | 2 +- .../reference/experimental/explicit-nulls.md | 2 +- .../other-new-features/safe-initialization.md | 2 +- .../other-new-features/safe-initialization.md | 2 +- project/Build.scala | 16 +- .../a/src/main/scala/a/A.scala | 0 .../b/src/main/scala/b/B.scala | 0 .../build.sbt | 2 +- .../project/DottyInjectedPlugin.scala | 0 .../test | 0 .../a/src/main/scala/a/A.scala | 0 .../b-early-out/.keep | 0 .../b/src/main/scala/b/B.scala | 0 .../build.sbt | 4 +- .../c/src/main/scala/c/C.scala | 0 .../project/DottyInjectedPlugin.scala | 0 .../test | 0 .../a/src/main/scala/a/A.java | 0 .../a/src/main/scala/a/package.scala | 0 .../b-alt/.keep | 0 .../b/src/main/scala/b/B.scala | 0 .../build.sbt | 4 +- .../project/DottyInjectedPlugin.scala | 0 .../test | 0 .../a/src/main/scala/a/A.java | 0 .../a/src/main/scala/a/package.scala | 0 .../b-alt/.keep | 0 .../b/src/main/scala/b/B.scala | 0 .../build.sbt | 4 +- .../project/DottyInjectedPlugin.scala | 0 .../test | 0 .../a/src/main/scala/a/A.java | 0 .../a/src/main/scala/a/package.scala | 0 .../a_from_tasty/.keep | 0 .../b-alt/.keep | 0 .../b/src/main/scala/b/B.scala | 0 .../build.sbt | 12 +- .../project/DottyInjectedPlugin.scala | 0 .../test | 0 .../a-check/.keep | 0 .../a/src/main/scala/a/A.java | 0 .../a/src/main/scala/a/AImport.java | 0 .../a/src/main/scala/a/package.scala | 0 .../b-alt/.keep | 0 .../b/src/main/scala/b/B.scala | 0 .../b/src/main/scala/b/BImport.scala | 0 .../build.sbt | 8 +- .../c-alt/.keep | 0 .../c/src/main/scala/c/C.scala | 0 .../c/src/main/scala/c/CImport.scala | 0 .../project/DottyInjectedPlugin.scala | 0 .../test | 0 .../a/src/main/scala/a/A.java | 0 .../a/src/main/scala/a/package.scala | 0 .../b-alt/.keep | 0 .../b/src/main/scala/b/B.scala | 0 .../build.sbt | 4 +- .../project/DottyInjectedPlugin.scala | 0 .../test | 0 .../a/InnerClass.java | 0 .../a/InnerClassGen.java | 0 .../a/InnerClassSub.java | 0 .../a/RawTypes.java | 0 .../a/package.scala | 0 .../b/Test.scala | 0 .../build.sbt | 4 +- .../project/DottyInjectedPlugin.scala | 0 .../test | 0 .../a/src/main/scala/a/A.java | 0 .../a/src/main/scala/a/package.scala | 0 .../b-alt/.keep | 0 .../b/src/main/scala/b/B.scala | 0 .../build.sbt | 4 +- .../project/DottyInjectedPlugin.scala | 0 .../test | 0 sbt-test/pipelining/pipelining-test/test | 10 +- .../scaladoc/snippets/SnippetCompiler.scala | 4 +- .../tasty/inspector/TastyInspector.scala | 2 +- .../scala/quoted/staging/QuoteDriver.scala | 8 +- .../tasty/inspector/TastyInspector.scala | 2 +- tests/explicit-nulls/pos/i14682.scala | 4 +- tests/neg/i16438.scala | 2 +- tests/neg/i2887b.check | 2 +- tests/neg/kind-projector-underscores.scala | 2 +- tests/neg/kind-projector.scala | 2 +- tests/pos/i16777.scala | 2 +- tests/pos/i19806/Module.scala | 2 +- tests/pos/kind-projector-underscores.scala | 2 +- tests/pos/kind-projector.scala | 2 +- tests/run-macros/i12351/Test_2.scala | 2 +- tests/run-macros/i12352/Main.scala | 2 +- tests/untried/neg/choices.check | 2 +- tests/untried/neg/choices.flags | 2 +- 142 files changed, 581 insertions(+), 279 deletions(-) rename sbt-test/pipelining/{Yearly-tasty-output-inline => Xearly-tasty-output-inline}/a/src/main/scala/a/A.scala (100%) rename sbt-test/pipelining/{Yearly-tasty-output-inline => Xearly-tasty-output-inline}/b/src/main/scala/b/B.scala (100%) rename sbt-test/pipelining/{Yearly-tasty-output-inline => Xearly-tasty-output-inline}/build.sbt (90%) rename sbt-test/pipelining/{Yearly-tasty-output-inline => Xearly-tasty-output-inline}/project/DottyInjectedPlugin.scala (100%) rename sbt-test/pipelining/{Yearly-tasty-output-inline => Xearly-tasty-output-inline}/test (100%) rename sbt-test/pipelining/{Yearly-tasty-output => Xearly-tasty-output}/a/src/main/scala/a/A.scala (100%) rename sbt-test/pipelining/{Yearly-tasty-output => Xearly-tasty-output}/b-early-out/.keep (100%) rename sbt-test/pipelining/{Yearly-tasty-output => Xearly-tasty-output}/b/src/main/scala/b/B.scala (100%) rename sbt-test/pipelining/{Yearly-tasty-output => Xearly-tasty-output}/build.sbt (87%) rename sbt-test/pipelining/{Yearly-tasty-output => Xearly-tasty-output}/c/src/main/scala/c/C.scala (100%) rename sbt-test/pipelining/{Yearly-tasty-output => Xearly-tasty-output}/project/DottyInjectedPlugin.scala (100%) rename sbt-test/pipelining/{Yearly-tasty-output => Xearly-tasty-output}/test (100%) rename sbt-test/pipelining/{Yjava-tasty-annotation => Xjava-tasty-annotation}/a/src/main/scala/a/A.java (100%) rename sbt-test/pipelining/{Yjava-tasty-annotation => Xjava-tasty-annotation}/a/src/main/scala/a/package.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-annotation => Xjava-tasty-annotation}/b-alt/.keep (100%) rename sbt-test/pipelining/{Yjava-tasty-annotation => Xjava-tasty-annotation}/b/src/main/scala/b/B.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-annotation => Xjava-tasty-annotation}/build.sbt (87%) rename sbt-test/pipelining/{Yjava-tasty-annotation => Xjava-tasty-annotation}/project/DottyInjectedPlugin.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-annotation => Xjava-tasty-annotation}/test (100%) rename sbt-test/pipelining/{Yjava-tasty-enum => Xjava-tasty-enum}/a/src/main/scala/a/A.java (100%) rename sbt-test/pipelining/{Yjava-tasty-enum => Xjava-tasty-enum}/a/src/main/scala/a/package.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-enum => Xjava-tasty-enum}/b-alt/.keep (100%) rename sbt-test/pipelining/{Yjava-tasty-enum => Xjava-tasty-enum}/b/src/main/scala/b/B.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-enum => Xjava-tasty-enum}/build.sbt (92%) rename sbt-test/pipelining/{Yjava-tasty-enum => Xjava-tasty-enum}/project/DottyInjectedPlugin.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-enum => Xjava-tasty-enum}/test (100%) rename sbt-test/pipelining/{Yjava-tasty-from-tasty => Xjava-tasty-from-tasty}/a/src/main/scala/a/A.java (100%) rename sbt-test/pipelining/{Yjava-tasty-from-tasty => Xjava-tasty-from-tasty}/a/src/main/scala/a/package.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-from-tasty => Xjava-tasty-from-tasty}/a_from_tasty/.keep (100%) rename sbt-test/pipelining/{Yjava-tasty-from-tasty => Xjava-tasty-from-tasty}/b-alt/.keep (100%) rename sbt-test/pipelining/{Yjava-tasty-from-tasty => Xjava-tasty-from-tasty}/b/src/main/scala/b/B.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-from-tasty => Xjava-tasty-from-tasty}/build.sbt (87%) rename sbt-test/pipelining/{Yjava-tasty-from-tasty => Xjava-tasty-from-tasty}/project/DottyInjectedPlugin.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-from-tasty => Xjava-tasty-from-tasty}/test (100%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/a-check/.keep (100%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/a/src/main/scala/a/A.java (100%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/a/src/main/scala/a/AImport.java (100%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/a/src/main/scala/a/package.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/b-alt/.keep (100%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/b/src/main/scala/b/B.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/b/src/main/scala/b/BImport.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/build.sbt (91%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/c-alt/.keep (100%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/c/src/main/scala/c/C.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/c/src/main/scala/c/CImport.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/project/DottyInjectedPlugin.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-fromjavaobject => Xjava-tasty-fromjavaobject}/test (100%) rename sbt-test/pipelining/{Yjava-tasty-generic => Xjava-tasty-generic}/a/src/main/scala/a/A.java (100%) rename sbt-test/pipelining/{Yjava-tasty-generic => Xjava-tasty-generic}/a/src/main/scala/a/package.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-generic => Xjava-tasty-generic}/b-alt/.keep (100%) rename sbt-test/pipelining/{Yjava-tasty-generic => Xjava-tasty-generic}/b/src/main/scala/b/B.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-generic => Xjava-tasty-generic}/build.sbt (91%) rename sbt-test/pipelining/{Yjava-tasty-generic => Xjava-tasty-generic}/project/DottyInjectedPlugin.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-generic => Xjava-tasty-generic}/test (100%) rename sbt-test/pipelining/{Yjava-tasty-paths => Xjava-tasty-paths}/a/InnerClass.java (100%) rename sbt-test/pipelining/{Yjava-tasty-paths => Xjava-tasty-paths}/a/InnerClassGen.java (100%) rename sbt-test/pipelining/{Yjava-tasty-paths => Xjava-tasty-paths}/a/InnerClassSub.java (100%) rename sbt-test/pipelining/{Yjava-tasty-paths => Xjava-tasty-paths}/a/RawTypes.java (100%) rename sbt-test/pipelining/{Yjava-tasty-paths => Xjava-tasty-paths}/a/package.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-paths => Xjava-tasty-paths}/b/Test.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-paths => Xjava-tasty-paths}/build.sbt (92%) rename sbt-test/pipelining/{Yjava-tasty-paths => Xjava-tasty-paths}/project/DottyInjectedPlugin.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-paths => Xjava-tasty-paths}/test (100%) rename sbt-test/pipelining/{Yjava-tasty-result-types => Xjava-tasty-result-types}/a/src/main/scala/a/A.java (100%) rename sbt-test/pipelining/{Yjava-tasty-result-types => Xjava-tasty-result-types}/a/src/main/scala/a/package.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-result-types => Xjava-tasty-result-types}/b-alt/.keep (100%) rename sbt-test/pipelining/{Yjava-tasty-result-types => Xjava-tasty-result-types}/b/src/main/scala/b/B.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-result-types => Xjava-tasty-result-types}/build.sbt (92%) rename sbt-test/pipelining/{Yjava-tasty-result-types => Xjava-tasty-result-types}/project/DottyInjectedPlugin.scala (100%) rename sbt-test/pipelining/{Yjava-tasty-result-types => Xjava-tasty-result-types}/test (100%) diff --git a/community-build/community-projects/AsyncFile b/community-build/community-projects/AsyncFile index d72a5279e4b0..7bdd11657e3e 160000 --- a/community-build/community-projects/AsyncFile +++ b/community-build/community-projects/AsyncFile @@ -1 +1 @@ -Subproject commit d72a5279e4b055ad13d1c19d75939b9bd9d014a0 +Subproject commit 7bdd11657e3e840c31f27140942c8dc9e07ea7b8 diff --git a/community-build/community-projects/Equal b/community-build/community-projects/Equal index 4340d3a6b503..4f357131b4ea 160000 --- a/community-build/community-projects/Equal +++ b/community-build/community-projects/Equal @@ -1 +1 @@ -Subproject commit 4340d3a6b503aad4fbea89ee6026923127e8b1ab +Subproject commit 4f357131b4ea719ba5d09a62dd577a8aab204c4d diff --git a/community-build/community-projects/FingerTree b/community-build/community-projects/FingerTree index 0ed006549a78..eaadc6e0c660 160000 --- a/community-build/community-projects/FingerTree +++ b/community-build/community-projects/FingerTree @@ -1 +1 @@ -Subproject commit 0ed006549a78036aac0b09375e90237e72f599fe +Subproject commit eaadc6e0c660d27fc77a2cb4ab6a265a8e746f97 diff --git a/community-build/community-projects/Log b/community-build/community-projects/Log index 1839754549ed..c55ac4b7a822 160000 --- a/community-build/community-projects/Log +++ b/community-build/community-projects/Log @@ -1 +1 @@ -Subproject commit 1839754549ed690fbba2ea1b220e3f70f8d2ba91 +Subproject commit c55ac4b7a82278f896f25b291e129440d2436fb4 diff --git a/community-build/community-projects/Lucre b/community-build/community-projects/Lucre index 0def1dcb1aa6..1008f0b7f513 160000 --- a/community-build/community-projects/Lucre +++ b/community-build/community-projects/Lucre @@ -1 +1 @@ -Subproject commit 0def1dcb1aa63ba8f398428c000cb2a2f166cca4 +Subproject commit 1008f0b7f51374ddbc947e677c505fa97677b7d4 diff --git a/community-build/community-projects/Model b/community-build/community-projects/Model index d797f70e9d17..fb73627f37d7 160000 --- a/community-build/community-projects/Model +++ b/community-build/community-projects/Model @@ -1 +1 @@ -Subproject commit d797f70e9d178fa6a70d6aa2d3c3324bc1c27b48 +Subproject commit fb73627f37d77d97892a4a0eebe5bd7406559366 diff --git a/community-build/community-projects/Numbers b/community-build/community-projects/Numbers index 656dfd3f7c0a..e19972adb794 160000 --- a/community-build/community-projects/Numbers +++ b/community-build/community-projects/Numbers @@ -1 +1 @@ -Subproject commit 656dfd3f7c0a541b243e2d0f5aabbd20fc8bcea6 +Subproject commit e19972adb7941871e8b1b4a76de0e0c2b4d9fbfc diff --git a/community-build/community-projects/Serial b/community-build/community-projects/Serial index c161cc36e68c..e69b44086955 160000 --- a/community-build/community-projects/Serial +++ b/community-build/community-projects/Serial @@ -1 +1 @@ -Subproject commit c161cc36e68c0d24a508fc9a52a44551c779c682 +Subproject commit e69b44086955023b8747ac10791ad10baad0c5cc diff --git a/community-build/community-projects/Span b/community-build/community-projects/Span index da4c4a9c335c..8d9b4575482e 160000 --- a/community-build/community-projects/Span +++ b/community-build/community-projects/Span @@ -1 +1 @@ -Subproject commit da4c4a9c335c114dbda829150d6476aec830cb84 +Subproject commit 8d9b4575482e103117b3fd2b016c7aaad5962789 diff --git a/community-build/community-projects/discipline b/community-build/community-projects/discipline index 09c975b18dc0..27016c356287 160000 --- a/community-build/community-projects/discipline +++ b/community-build/community-projects/discipline @@ -1 +1 @@ -Subproject commit 09c975b18dc0b4e10499fb2922abac82ea8b5252 +Subproject commit 27016c3562871c136e88cc13ffa64a02380265df diff --git a/community-build/community-projects/discipline-munit b/community-build/community-projects/discipline-munit index 4e61f1861956..975ae3efaddd 160000 --- a/community-build/community-projects/discipline-munit +++ b/community-build/community-projects/discipline-munit @@ -1 +1 @@ -Subproject commit 4e61f186195660529e7a6f7461b939477735e3f4 +Subproject commit 975ae3efadddaa558435c4c8326628618048fdad diff --git a/community-build/community-projects/discipline-specs2 b/community-build/community-projects/discipline-specs2 index e689c3e809a8..eb9427335a30 160000 --- a/community-build/community-projects/discipline-specs2 +++ b/community-build/community-projects/discipline-specs2 @@ -1 +1 @@ -Subproject commit e689c3e809a89a03cdbbb3a1771e33148715f6c7 +Subproject commit eb9427335a309d6dd1e82632298529ca6a0920fa diff --git a/community-build/community-projects/fs2 b/community-build/community-projects/fs2 index 6d7c6d6924cb..e91c54621b76 160000 --- a/community-build/community-projects/fs2 +++ b/community-build/community-projects/fs2 @@ -1 +1 @@ -Subproject commit 6d7c6d6924cb055028458ac8236622190acf66d1 +Subproject commit e91c54621b762a58c942b6576c42dcd94ba0fc0a diff --git a/community-build/community-projects/scala-stm b/community-build/community-projects/scala-stm index 3244edf13c41..cf204977752a 160000 --- a/community-build/community-projects/scala-stm +++ b/community-build/community-projects/scala-stm @@ -1 +1 @@ -Subproject commit 3244edf13c41f22ff8b45143186745e9eb469220 +Subproject commit cf204977752af7ec2ca3b50c43f27daa6a628f49 diff --git a/community-build/community-projects/scodec b/community-build/community-projects/scodec index b74f2085f071..9b0423b90de9 160000 --- a/community-build/community-projects/scodec +++ b/community-build/community-projects/scodec @@ -1 +1 @@ -Subproject commit b74f2085f07165d84b32c39eb214c9cc838711cc +Subproject commit 9b0423b90de95fc968fafe4543e6b16ef9f81d08 diff --git a/community-build/community-projects/verify b/community-build/community-projects/verify index ae37d7e153fc..f82bb3f52623 160000 --- a/community-build/community-projects/verify +++ b/community-build/community-projects/verify @@ -1 +1 @@ -Subproject commit ae37d7e153fc62d64c40a72c45f810511aef2e01 +Subproject commit f82bb3f52623e44f02b4b43f8bdf27f4f0a7d3d4 diff --git a/community-build/src/scala/dotty/communitybuild/projects.scala b/community-build/src/scala/dotty/communitybuild/projects.scala index cc0f0ac1f20f..a0444505801a 100644 --- a/community-build/src/scala/dotty/communitybuild/projects.scala +++ b/community-build/src/scala/dotty/communitybuild/projects.scala @@ -149,7 +149,7 @@ final case class SbtCommunityProject( object SbtCommunityProject: def scalacOptions = List( "-Xcheck-macros", - "-Ysafe-init", + "-Wsafe-init", ) object projects: @@ -362,7 +362,7 @@ object projects: project = "shapeless-3", sbtTestCommand = "testJVM; testJS", sbtDocCommand = forceDoc("typeable", "deriving"), - scalacOptions = "-source" :: "3.3" :: SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"), // due to -Xfatal-warnings + scalacOptions = "-source" :: "3.3" :: SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"), // due to -Xfatal-warnings ) lazy val xmlInterpolator = SbtCommunityProject( @@ -429,7 +429,7 @@ object projects: sbtTestCommand = "unitTests/test", // Adds package sbtDocCommand = "coreJVM/doc", - scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"), + scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"), dependencies = List(munit, scodecBits), ) @@ -510,7 +510,7 @@ object projects: project = "discipline", sbtTestCommand = "coreJVM/test;coreJS/test", sbtPublishCommand = "set every credentials := Nil;coreJVM/publishLocal;coreJS/publishLocal", - scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"), + scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"), dependencies = List(scalacheck) ) @@ -526,7 +526,7 @@ object projects: sbtTestCommand = "test", sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal", dependencies = List(discipline), - scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init") + scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init") ) lazy val simulacrumScalafixAnnotations = SbtCommunityProject( @@ -540,8 +540,7 @@ object projects: sbtTestCommand = "set Global/scalaJSStage := FastOptStage;rootJVM/test;rootJS/test", sbtPublishCommand = "rootJVM/publishLocal;rootJS/publishLocal", dependencies = List(discipline, disciplineMunit, scalacheck, simulacrumScalafixAnnotations), - scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init") // disable -Ysafe-init, due to -Xfatal-warning - + scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init") // disable -Ysafe-init or -Wsafe-init, due to -Xfatal-warning ) lazy val catsMtl = SbtCommunityProject( @@ -656,7 +655,7 @@ object projects: """set actorTests/Compile/scalacOptions -= "-Xfatal-warnings"""", "akka-actor-tests/Test/compile", ).mkString("; "), - scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"), + scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"), dependencies = List(scalatest, scalatestplusJunit, scalatestplusScalacheck) ) @@ -707,7 +706,7 @@ object projects: project = "fs2", sbtTestCommand = "coreJVM/test; coreJS/test", // io/test requires JDK9+ sbtPublishCommand = "coreJVM/publishLocal; coreJS/publishLocal", - scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"), + scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"), dependencies = List(cats, catsEffect3, munitCatsEffect, scalacheckEffect, scodecBits) ) @@ -744,7 +743,7 @@ object projects: project = "http4s", sbtTestCommand = """set ThisBuild / tlFatalWarnings := false; rootJVM/test""", sbtPublishCommand = "publishLocal", - scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"), + scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"), dependencies = List(cats, catsEffect3, fs2, disciplineMunit, scalacheckEffect) ) diff --git a/compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala b/compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala index 385521e2785f..f8866f40d9d4 100644 --- a/compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala +++ b/compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala @@ -823,7 +823,7 @@ trait BCodeHelpers extends BCodeIdiomatic { // without it. This is particularly bad because the availability of // generic information could disappear as a consequence of a seemingly // unrelated change. - ctx.base.settings.YnoGenericSig.value + ctx.base.settings.XnoGenericSig.value || sym.is(Artifact) || sym.isAllOf(LiftedMethod) || sym.is(Bridge) diff --git a/compiler/src/dotty/tools/backend/jvm/PostProcessorFrontendAccess.scala b/compiler/src/dotty/tools/backend/jvm/PostProcessorFrontendAccess.scala index f7955cbb350c..e1b2120fa848 100644 --- a/compiler/src/dotty/tools/backend/jvm/PostProcessorFrontendAccess.scala +++ b/compiler/src/dotty/tools/backend/jvm/PostProcessorFrontendAccess.scala @@ -121,12 +121,14 @@ object PostProcessorFrontendAccess { case (None, None) => "8" // least supported version by default override val debug: Boolean = ctx.debug - override val dumpClassesDirectory: Option[String] = s.Ydumpclasses.valueSetByUser + override val dumpClassesDirectory: Option[String] = s.Xdumpclasses.valueSetByUser override val outputDirectory: AbstractFile = s.outputDir.value override val mainClass: Option[String] = s.XmainClass.valueSetByUser - override val jarCompressionLevel: Int = s.YjarCompressionLevel.value + override val jarCompressionLevel: Int = s.XjarCompressionLevel.value override val backendParallelism: Int = s.YbackendParallelism.value override val backendMaxWorkerQueue: Option[Int] = s.YbackendWorkerQueue.valueSetByUser + + @annotation.nowarn("cat=deprecation") override val outputOnlyTasty: Boolean = s.YoutputOnlyTasty.value } diff --git a/compiler/src/dotty/tools/dotc/Driver.scala b/compiler/src/dotty/tools/dotc/Driver.scala index 6625b5ca6ea2..98abe2ac6c38 100644 --- a/compiler/src/dotty/tools/dotc/Driver.scala +++ b/compiler/src/dotty/tools/dotc/Driver.scala @@ -84,7 +84,7 @@ class Driver { Positioned.init(using ictx) inContext(ictx) { - if !ctx.settings.YdropComments.value || ctx.settings.YreadComments.value then + if !ctx.settings.XdropComments.value || ctx.settings.XreadComments.value then ictx.setProperty(ContextDoc, new ContextDocstrings) val fileNamesOrNone = command.checkUsage(summary, sourcesRequired)(using ctx.settings)(using ctx.settingsState) fileNamesOrNone.map { fileNames => diff --git a/compiler/src/dotty/tools/dotc/Run.scala b/compiler/src/dotty/tools/dotc/Run.scala index fa827432460a..11a0430480d9 100644 --- a/compiler/src/dotty/tools/dotc/Run.scala +++ b/compiler/src/dotty/tools/dotc/Run.scala @@ -377,7 +377,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint runCtx.withProgressCallback: cb => _progress = Progress(cb, this, fusedPhases.map(_.traversals).sum) val cancelAsyncTasty: () => Unit = - if !myAsyncTastyWritten && Phases.picklerPhase.exists && !ctx.settings.YearlyTastyOutput.isDefault then + if !myAsyncTastyWritten && Phases.picklerPhase.exists && !ctx.settings.XearlyTastyOutput.isDefault then initializeAsyncTasty() else () => {} diff --git a/compiler/src/dotty/tools/dotc/config/CliCommand.scala b/compiler/src/dotty/tools/dotc/config/CliCommand.scala index be97297218fa..5ac6b772df95 100644 --- a/compiler/src/dotty/tools/dotc/config/CliCommand.scala +++ b/compiler/src/dotty/tools/dotc/config/CliCommand.scala @@ -60,7 +60,8 @@ trait CliCommand: def defaultValue = s.default match case _: Int | _: String => s.default.toString case _ => "" - val info = List(shortHelp(s), if defaultValue.nonEmpty then s"Default $defaultValue" else "", if s.legalChoices.nonEmpty then s"Choices : ${s.legalChoices}" else "") + val deprecationMessage = s.deprecation.map(d => s"Option deprecated.\n${d.msg}").getOrElse("") + val info = List(deprecationMessage, shortHelp(s), if defaultValue.nonEmpty then s"Default $defaultValue" else "", if s.legalChoices.nonEmpty then s"Choices : ${s.legalChoices}" else "") (s.name, info.filter(_.nonEmpty).mkString("\n")) end help diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index 94b6d8023c34..86b657ddf00d 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -3,7 +3,7 @@ package config import scala.language.unsafeNulls import dotty.tools.dotc.config.PathResolver.Defaults -import dotty.tools.dotc.config.Settings.{Setting, SettingGroup, SettingCategory} +import dotty.tools.dotc.config.Settings.{Setting, SettingGroup, SettingCategory, Deprecation} import dotty.tools.dotc.config.SourceVersion import dotty.tools.dotc.core.Contexts.* import dotty.tools.dotc.rewrites.Rewrites @@ -296,6 +296,7 @@ private sealed trait WarningSettings: def typeParameterShadow(using Context) = allOr("type-parameter-shadow") + val WcheckInit: Setting[Boolean] = BooleanSetting(WarningSetting, "Wsafe-init", "Ensure safe initialization of objects.") /** -X "Extended" or "Advanced" settings */ private sealed trait XSettings: @@ -322,6 +323,27 @@ private sealed trait XSettings: val XmainClass: Setting[String] = StringSetting(AdvancedSetting, "Xmain-class", "path", "Class for manifest's Main-Class entry (only useful with -d )", "") val XimplicitSearchLimit: Setting[Int] = IntSetting(AdvancedSetting, "Ximplicit-search-limit", "Maximal number of expressions to be generated in an implicit search", 50000) + val XtermConflict: Setting[String] = ChoiceSetting(AdvancedSetting, "Xresolve-term-conflict", "strategy", "Resolve term conflicts", List("package", "object", "error"), "error") + val XnoGenericSig: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xno-generic-signatures", "Suppress generation of generic signatures for Java.") + val Xdumpclasses: Setting[String] = StringSetting(AdvancedSetting, "Xdump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", "") + val XjarCompressionLevel: Setting[Int] = IntChoiceSetting(AdvancedSetting, "Xjar-compression-level", "compression level to use when writing jar files", Deflater.DEFAULT_COMPRESSION to Deflater.BEST_COMPRESSION, Deflater.DEFAULT_COMPRESSION) + val XkindProjector: Setting[String] = ChoiceSetting(AdvancedSetting, "Xkind-projector", "[underscores, enable, disable]", "Allow `*` as type lambda placeholder to be compatible with kind projector. When invoked as -Xkind-projector:underscores will repurpose `_` to be a type parameter placeholder, this will disable usage of underscore as a wildcard.", List("disable", "", "underscores"), "disable", legacyArgs = true) + + /** Documentation related settings */ + val XdropComments: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xdrop-docs", "Drop documentation when scanning source files.", aliases = List("-Xdrop-comments")) + val XcookComments: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xcook-docs", "Cook the documentation (type check `@usecase`, etc.)", aliases = List("-Xcook-comments")) + val XreadComments: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xread-docs", "Read documentation from tasty.") + + /** Area-specific debug output */ + val XnoDecodeStacktraces: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xno-decode-stacktraces", "Show raw StackOverflow stacktraces, instead of decoding them into triggering operations.") + val XnoEnrichErrorMessages: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xno-enrich-error-messages", "Show raw error messages, instead of enriching them with contextual information.") + val XdebugMacros: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xdebug-macros", "Show debug info when quote pattern match fails") + + /** Pipeline compilation options */ + val XjavaTasty: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xjava-tasty", "Pickler phase should compute TASTy for .java defined symbols for use by build tools", aliases = List("-Xpickle-java", "-Yjava-tasty", "-Ypickle-java"), preferPrevious = true) + val XearlyTastyOutput: Setting[AbstractFile] = OutputSetting(AdvancedSetting, "Xearly-tasty-output", "directory|jar", "Destination to write generated .tasty files to for use in pipelined compilation.", NoAbstractFile, aliases = List("-Xpickle-write", "-Yearly-tasty-output", "-Ypickle-write"), preferPrevious = true) + val XallowOutlineFromTasty: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xallow-outline-from-tasty", "Allow outline TASTy to be loaded with the -from-tasty option.", aliases = List("-Yallow-outline-from-tasty")) + val XmixinForceForwarders = ChoiceSetting( AdvancedSetting, name = "Xmixin-force-forwarders", @@ -337,8 +359,8 @@ private sealed trait XSettings: val XmacroSettings: Setting[List[String]] = MultiStringSetting(AdvancedSetting, "Xmacro-settings", "setting1,setting2,..settingN", "List of settings which exposed to the macros") - // Deprecated - val Xlint: Setting[_] = DeprecatedSetting(AdvancedSetting, "Xlint", "Enable or disable specific warnings", "Use -Wshadow to enable shadowing lints.") + @deprecated(message = "Superseded by -Wshadow, Scheduled for removal", since = "3.5.0") + val Xlint: Setting[_] = BooleanSetting(AdvancedSetting, "Xlint", "Enable or disable specific warnings", deprecation = Some(Deprecation("Use -Wshadow to enable shadowing lints. Scheduled for removal.")), ignoreInvalidArgs = true) end XSettings @@ -360,7 +382,6 @@ private sealed trait YSettings: val YdebugError: Setting[Boolean] = BooleanSetting(ForkSetting, "Ydebug-error", "Print the stack trace when any error is caught.", false) val YdebugUnpickling: Setting[Boolean] = BooleanSetting(ForkSetting, "Ydebug-unpickling", "Print the stack trace when an error occurs when reading Tasty.", false) val YdebugCyclic: Setting[Boolean] = BooleanSetting(ForkSetting, "Ydebug-cyclic", "Print the stack trace when a cyclic reference error occurs.", false) - val YtermConflict: Setting[String] = ChoiceSetting(ForkSetting, "Yresolve-term-conflict", "strategy", "Resolve term conflicts", List("package", "object", "error"), "error") val Ylog: Setting[List[String]] = PhasesSetting(ForkSetting, "Ylog", "Log operations during") val YlogClasspath: Setting[Boolean] = BooleanSetting(ForkSetting, "Ylog-classpath", "Output information about what classpath is being applied.") val YdisableFlatCpCaching: Setting[Boolean] = BooleanSetting(ForkSetting, "YdisableFlatCpCaching", "Do not cache flat classpath representation of classpath elements from jars across compiler instances.") @@ -369,18 +390,14 @@ private sealed trait YSettings: val YnoImports: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-imports", "Compile without importing scala.*, java.lang.*, or Predef.") val Yimports: Setting[List[String]] = MultiStringSetting(ForkSetting, "Yimports", helpArg="", "Custom root imports. If set, none of scala.*, java.lang.*, or Predef.* will be imported unless explicitly included.") - val YnoGenericSig: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-generic-signatures", "Suppress generation of generic signatures for Java.") val YnoPredef: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-predef", "Compile without importing Predef.") val Yskip: Setting[List[String]] = PhasesSetting(ForkSetting, "Yskip", "Skip") - val Ydumpclasses: Setting[String] = StringSetting(ForkSetting, "Ydump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", "") - val YjarCompressionLevel: Setting[Int] = IntChoiceSetting(ForkSetting, "Yjar-compression-level", "compression level to use when writing jar files", Deflater.DEFAULT_COMPRESSION to Deflater.BEST_COMPRESSION, Deflater.DEFAULT_COMPRESSION) val YbackendParallelism: Setting[Int] = IntChoiceSetting(ForkSetting, "Ybackend-parallelism", "maximum worker threads for backend", 1 to 16, 1) val YbackendWorkerQueue: Setting[Int] = IntChoiceSetting(ForkSetting, "Ybackend-worker-queue", "backend threads worker queue size", 0 to 1000, 0) val YstopAfter: Setting[List[String]] = PhasesSetting(ForkSetting, "Ystop-after", "Stop after", aliases = List("-stop")) // backward compat val YstopBefore: Setting[List[String]] = PhasesSetting(ForkSetting, "Ystop-before", "Stop before") // stop before erasure as long as we have not debugged it fully val YshowSuppressedErrors: Setting[Boolean] = BooleanSetting(ForkSetting, "Yshow-suppressed-errors", "Also show follow-on errors and warnings that are normally suppressed.") val YdetailedStats: Setting[Boolean] = BooleanSetting(ForkSetting, "Ydetailed-stats", "Show detailed internal compiler stats (needs Stats.enabled to be set to true).") - val YkindProjector: Setting[String] = ChoiceSetting(ForkSetting, "Ykind-projector", "[underscores, enable, disable]", "Allow `*` as type lambda placeholder to be compatible with kind projector. When invoked as -Ykind-projector:underscores will repurpose `_` to be a type parameter placeholder, this will disable usage of underscore as a wildcard.", List("disable", "", "underscores"), "disable", legacyArgs = true) val YprintPos: Setting[Boolean] = BooleanSetting(ForkSetting, "Yprint-pos", "Show tree positions.") val YprintPosSyms: Setting[Boolean] = BooleanSetting(ForkSetting, "Yprint-pos-syms", "Show symbol definitions positions.") val YnoDeepSubtypes: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-deep-subtypes", "Throw an exception on deep subtyping call stacks.") @@ -396,9 +413,6 @@ private sealed trait YSettings: val YtestPickler: Setting[Boolean] = BooleanSetting(ForkSetting, "Ytest-pickler", "Self-test for pickling functionality; should be used with -Ystop-after:pickler.") val YtestPicklerCheck: Setting[Boolean] = BooleanSetting(ForkSetting, "Ytest-pickler-check", "Self-test for pickling -print-tasty output; should be used with -Ytest-pickler.") val YcheckReentrant: Setting[Boolean] = BooleanSetting(ForkSetting, "Ycheck-reentrant", "Check that compiled program does not contain vars that can be accessed from a global root.") - val YdropComments: Setting[Boolean] = BooleanSetting(ForkSetting, "Ydrop-docs", "Drop documentation when scanning source files.", aliases = List("-Ydrop-comments")) - val YcookComments: Setting[Boolean] = BooleanSetting(ForkSetting, "Ycook-docs", "Cook the documentation (type check `@usecase`, etc.)", aliases = List("-Ycook-comments")) - val YreadComments: Setting[Boolean] = BooleanSetting(ForkSetting, "Yread-docs", "Read documentation from tasty.") val YforceSbtPhases: Setting[Boolean] = BooleanSetting(ForkSetting, "Yforce-sbt-phases", "Run the phases used by sbt for incremental compilation (ExtractDependencies and ExtractAPI) even if the compiler is ran outside of sbt, for debugging.") val YdumpSbtInc: Setting[Boolean] = BooleanSetting(ForkSetting, "Ydump-sbt-inc", "For every compiled foo.scala, output the API representation and dependencies used for sbt incremental compilation in foo.inc, implies -Yforce-sbt-phases.") val YcheckAllPatmat: Setting[Boolean] = BooleanSetting(ForkSetting, "Ycheck-all-patmat", "Check exhaustivity and redundancy of all pattern matching (used for testing the algorithm).") @@ -408,7 +422,6 @@ private sealed trait YSettings: val YfromTastyIgnoreList: Setting[List[String]] = MultiStringSetting(ForkSetting, "Yfrom-tasty-ignore-list", "file", "List of `tasty` files in jar files that will not be loaded when using -from-tasty.") val YlegacyLazyVals: Setting[Boolean] = BooleanSetting(ForkSetting, "Ylegacy-lazy-vals", "Use legacy (pre 3.3.0) implementation of lazy vals.") val YcompileScala2Library: Setting[Boolean] = BooleanSetting(ForkSetting, "Ycompile-scala2-library", "Used when compiling the Scala 2 standard library.") - val YoutputOnlyTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Youtput-only-tasty", "Used to only generate the TASTy file without the classfiles") val YprofileEnabled: Setting[Boolean] = BooleanSetting(ForkSetting, "Yprofile-enabled", "Enable profiling.") val YprofileDestination: Setting[String] = StringSetting(ForkSetting, "Yprofile-destination", "file", "Where to send profiling output - specify a file, default is to the console.", "") //.withPostSetHook( _ => YprofileEnabled.value = true ) @@ -424,7 +437,6 @@ private sealed trait YSettings: val YnoKindPolymorphism: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-kind-polymorphism", "Disable kind polymorphism.") val YexplicitNulls: Setting[Boolean] = BooleanSetting(ForkSetting, "Yexplicit-nulls", "Make reference types non-nullable. Nullable types can be expressed with unions: e.g. String|Null.") val YnoFlexibleTypes: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-flexible-types", "Disable turning nullable Java return types and parameter types into flexible types, which behave like abstract types with a nullable lower bound and non-nullable upper bound.") - val YcheckInit: Setting[Boolean] = BooleanSetting(ForkSetting, "Ysafe-init", "Ensure safe initialization of objects.") val YcheckInitGlobal: Setting[Boolean] = BooleanSetting(ForkSetting, "Ysafe-init-global", "Check safe initialization of global objects.") val YrequireTargetName: Setting[Boolean] = BooleanSetting(ForkSetting, "Yrequire-targetName", "Warn if an operator is defined without a @targetName annotation.") val YrecheckTest: Setting[Boolean] = BooleanSetting(ForkSetting, "Yrecheck-test", "Run basic rechecking (internal test only).") @@ -438,16 +450,45 @@ private sealed trait YSettings: val YnoDoubleBindings: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-double-bindings", "Assert no namedtype is bound twice (should be enabled only if program is error-free).") val YshowVarBounds: Setting[Boolean] = BooleanSetting(ForkSetting, "Yshow-var-bounds", "Print type variables with their bounds.") - val YnoDecodeStacktraces: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-decode-stacktraces", "Show raw StackOverflow stacktraces, instead of decoding them into triggering operations.") - val YnoEnrichErrorMessages: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-enrich-error-messages", "Show raw error messages, instead of enriching them with contextual information.") - val Yinstrument: Setting[Boolean] = BooleanSetting(ForkSetting, "Yinstrument", "Add instrumentation code that counts allocations and closure creations.") val YinstrumentDefs: Setting[Boolean] = BooleanSetting(ForkSetting, "Yinstrument-defs", "Add instrumentation code that counts method calls; needs -Yinstrument to be set, too.") - val YdebugMacros: Setting[Boolean] = BooleanSetting(ForkSetting, "Ydebug-macros", "Show debug info when quote pattern match fails") - - // Pipeline compilation options - val YjavaTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Yjava-tasty", "Pickler phase should compute TASTy for .java defined symbols for use by build tools", aliases = List("-Ypickle-java"), preferPrevious = true) - val YearlyTastyOutput: Setting[AbstractFile] = OutputSetting(ForkSetting, "Yearly-tasty-output", "directory|jar", "Destination to write generated .tasty files to for use in pipelined compilation.", NoAbstractFile, aliases = List("-Ypickle-write"), preferPrevious = true) - val YallowOutlineFromTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Yallow-outline-from-tasty", "Allow outline TASTy to be loaded with the -from-tasty option.") + // Deprecated: lifted from -Y to -X + @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0") + val YtermConflict: Setting[String] = ChoiceSetting(ForkSetting, "Yresolve-term-conflict", "strategy", "Resolve term conflicts", List("package", "object", "error"), "error", deprecation = Deprecation.renamed("-Xresolve-term-conflict")) + @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0") + val YnoGenericSig: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-generic-signatures", "Suppress generation of generic signatures for Java.", deprecation = Deprecation.renamed("-Xno-generic-signatures")) + @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0") + val Ydumpclasses: Setting[String] = StringSetting(ForkSetting, "Ydump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", default = "", deprecation = Deprecation.renamed("-Xdump-classes")) + @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0") + val YjarCompressionLevel: Setting[Int] = IntChoiceSetting(ForkSetting, "Yjar-compression-level", "compression level to use when writing jar files", Deflater.DEFAULT_COMPRESSION to Deflater.BEST_COMPRESSION, Deflater.DEFAULT_COMPRESSION, deprecation = Deprecation.renamed("-Xjar-compression-level")) + @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0") + val YkindProjector: Setting[String] = ChoiceSetting(ForkSetting, "Ykind-projector", "[underscores, enable, disable]", "Allow `*` as type lambda placeholder to be compatible with kind projector. When invoked as -Ykind-projector:underscores will repurpose `_` to be a type parameter placeholder, this will disable usage of underscore as a wildcard.", List("disable", "", "underscores"), "disable", legacyArgs = true, deprecation = Deprecation.renamed("-Xkind-projector")) + @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0") + val YdropComments: Setting[Boolean] = BooleanSetting(ForkSetting, "Ydrop-docs", "Drop documentation when scanning source files.", aliases = List("-Ydrop-comments"), deprecation = Deprecation.renamed("-Xdrop-docs")) + @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0") + val YcookComments: Setting[Boolean] = BooleanSetting(ForkSetting, "Ycook-docs", "Cook the documentation (type check `@usecase`, etc.)", aliases = List("-Ycook-comments"), deprecation = Deprecation.renamed("-Xcook-docs")) + @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0") + val YreadComments: Setting[Boolean] = BooleanSetting(ForkSetting, "Yread-docs", "Read documentation from tasty.", deprecation = Deprecation.renamed("-Xread-docs")) + @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0") + val YnoDecodeStacktraces: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-decode-stacktraces", "Show raw StackOverflow stacktraces, instead of decoding them into triggering operations.", deprecation = Deprecation.renamed("-Xno-decode-stacktraces")) + @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0") + val YnoEnrichErrorMessages: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-enrich-error-messages", "Show raw error messages, instead of enriching them with contextual information.", deprecation = Deprecation.renamed("-Xno-enrich-error-messages")) + @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0") + val YdebugMacros: Setting[Boolean] = BooleanSetting(ForkSetting, "Ydebug-macros", "Show debug info when quote pattern match fails", deprecation = Deprecation.renamed("-Xdebug-macros")) + + // @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.7.0") + // val YjavaTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Yjava-tasty", "Pickler phase should compute TASTy for .java defined symbols for use by build tools", aliases = List("-Ypickle-java"), preferPrevious = true, deprecation = Deprecation.lifted("-Xjava-tasty")) + // @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.7.0") + // val YearlyTastyOutput: Setting[AbstractFile] = OutputSetting(ForkSetting, "Yearly-tasty-output", "directory|jar", "Destination to write generated .tasty files to for use in pipelined compilation.", NoAbstractFile, aliases = List("-Ypickle-write"), preferPrevious = true, deprecation = Deprecation.lifted("-Xearly-tasty-output")) + // @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.7.0") + // val YallowOutlineFromTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Yallow-outline-from-tasty", "Allow outline TASTy to be loaded with the -from-tasty option.", deprecation = Deprecation.lifted("-Xallow-outline-from-tasty")) + + // Deprecated: lifted from -Y to -W + @deprecated(message = "Lifted to -W, Scheduled for removal.", since = "3.5.0") + val YcheckInit: Setting[Boolean] = BooleanSetting(ForkSetting, "Ysafe-init", "Ensure safe initialization of objects.", deprecation = Deprecation.renamed("-Wsafe-init")) + + // Deprecated: Scheduled for removal + @deprecated(message = "Scheduled for removal.", since = "3.5.0") + val YoutputOnlyTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Youtput-only-tasty", "Used to only generate the TASTy file without the classfiles", deprecation = Deprecation.removed()) end YSettings diff --git a/compiler/src/dotty/tools/dotc/config/Settings.scala b/compiler/src/dotty/tools/dotc/config/Settings.scala index 241ab34052a1..1e2ced4d65a7 100644 --- a/compiler/src/dotty/tools/dotc/config/Settings.scala +++ b/compiler/src/dotty/tools/dotc/config/Settings.scala @@ -53,14 +53,16 @@ object Settings: sstate: SettingsState, arguments: List[String], errors: List[String], - warnings: List[String]) { + warnings: List[String]): def fail(msg: String): Settings.ArgsSummary = ArgsSummary(sstate, arguments.tail, errors :+ msg, warnings) def warn(msg: String): Settings.ArgsSummary = ArgsSummary(sstate, arguments.tail, errors, warnings :+ msg) - } + + def deprecated(msg: String, extraArgs: List[String] = Nil): Settings.ArgsSummary = + ArgsSummary(sstate, extraArgs ++ arguments.tail, errors, warnings :+ msg) @unshared val settingCharacters = "[a-zA-Z0-9_\\-]*".r @@ -81,9 +83,9 @@ object Settings: ignoreInvalidArgs: Boolean = false, preferPrevious: Boolean = false, propertyClass: Option[Class[?]] = None, - deprecationMsg: Option[String] = None, - // kept only for -Ykind-projector option compatibility - legacyArgs: Boolean = false)(private[Settings] val idx: Int) { + deprecation: Option[Deprecation] = None, + // kept only for -Xkind-projector option compatibility + legacyArgs: Boolean = false)(private[Settings] val idx: Int): validateSettingString(prefix.getOrElse(name)) aliases.foreach(validateSettingString) @@ -108,104 +110,114 @@ object Settings: def acceptsNoArg: Boolean = summon[ClassTag[T]] == BooleanTag || summon[ClassTag[T]] == OptionTag || choices.exists(_.contains("")) def legalChoices: String = - choices match { + choices match case Some(xs) if xs.isEmpty => "" case Some(r: Range) => s"${r.head}..${r.last}" case Some(xs) => xs.mkString(", ") case None => "" - } - def tryToSet(state: ArgsSummary): ArgsSummary = { + def tryToSet(state: ArgsSummary): ArgsSummary = val ArgsSummary(sstate, arg :: args, errors, warnings) = state: @unchecked - def update(value: Any, args: List[String]): ArgsSummary = - var dangers = warnings - val valueNew = - if sstate.wasChanged(idx) && isMultivalue then - val valueList = value.asInstanceOf[List[String]] - val current = valueIn(sstate).asInstanceOf[List[String]] - valueList.filter(current.contains).foreach(s => dangers :+= s"Setting $name set to $s redundantly") - current ++ valueList - else - if sstate.wasChanged(idx) then - assert(!preferPrevious, "should have shortcutted with ignoreValue, side-effect may be present!") - dangers :+= s"Flag $name set repeatedly" - value - ArgsSummary(updateIn(sstate, valueNew), args, errors, dangers) + + /** + * Updates the value in state + * + * @param getValue it is crucial that this argument is passed by name, as [setOutput] have side effects. + * @param argStringValue string value of currently proccessed argument that will be used to set deprecation replacement + * @param args remaining arguments to process + * @return new argumment state + */ + def update(getValue: => Any, argStringValue: String, args: List[String]): ArgsSummary = + deprecation match + case Some(Deprecation(msg, Some(replacedBy))) => + val deprecatedMsg = s"Option $name is deprecated: $msg" + if argStringValue.isEmpty then state.deprecated(deprecatedMsg, List(replacedBy)) + else state.deprecated(deprecatedMsg, List(s"$replacedBy:$argStringValue")) + + case Some(Deprecation(msg, _)) => + state.deprecated(s"Option $name is deprecated: $msg") + + case None => + val value = getValue + var dangers = warnings + val valueNew = + if sstate.wasChanged(idx) && isMultivalue then + val valueList = value.asInstanceOf[List[String]] + val current = valueIn(sstate).asInstanceOf[List[String]] + valueList.filter(current.contains).foreach(s => dangers :+= s"Setting $name set to $s redundantly") + current ++ valueList + else + if sstate.wasChanged(idx) then + assert(!preferPrevious, "should have shortcutted with ignoreValue, side-effect may be present!") + dangers :+= s"Flag $name set repeatedly" + value + ArgsSummary(updateIn(sstate, valueNew), args, errors, dangers) end update def ignoreValue(args: List[String]): ArgsSummary = ArgsSummary(sstate, args, errors, warnings) - def fail(msg: String, args: List[String]) = - ArgsSummary(sstate, args, errors :+ msg, warnings) - - def warn(msg: String, args: List[String]) = - ArgsSummary(sstate, args, errors, warnings :+ msg) - def missingArg = val msg = s"missing argument for option $name" - if ignoreInvalidArgs then warn(msg + ", the tag was ignored", args) else fail(msg, args) + if ignoreInvalidArgs then state.warn(msg + ", the tag was ignored") else state.fail(msg) def invalidChoices(invalid: List[String]) = val msg = s"invalid choice(s) for $name: ${invalid.mkString(",")}" - if ignoreInvalidArgs then warn(msg + ", the tag was ignored", args) else fail(msg, args) + if ignoreInvalidArgs then state.warn(msg + ", the tag was ignored") else state.fail(msg) def setBoolean(argValue: String, args: List[String]) = - if argValue.equalsIgnoreCase("true") || argValue.isEmpty then update(true, args) - else if argValue.equalsIgnoreCase("false") then update(false, args) - else fail(s"$argValue is not a valid choice for boolean setting $name", args) + if argValue.equalsIgnoreCase("true") || argValue.isEmpty then update(true, argValue, args) + else if argValue.equalsIgnoreCase("false") then update(false, argValue, args) + else state.fail(s"$argValue is not a valid choice for boolean setting $name") def setString(argValue: String, args: List[String]) = choices match case Some(xs) if !xs.contains(argValue) => - fail(s"$argValue is not a valid choice for $name", args) + state.fail(s"$argValue is not a valid choice for $name") case _ => - update(argValue, args) + update(argValue, argValue, args) def setInt(argValue: String, args: List[String]) = - try - val x = argValue.toInt + argValue.toIntOption.map: intValue => choices match - case Some(r: Range) if x < r.head || r.last < x => - fail(s"$argValue is out of legal range ${r.head}..${r.last} for $name", args) - case Some(xs) if !xs.contains(x) => - fail(s"$argValue is not a valid choice for $name", args) + case Some(r: Range) if intValue < r.head || r.last < intValue => + state.fail(s"$argValue is out of legal range ${r.head}..${r.last} for $name") + case Some(xs) if !xs.contains(intValue) => + state.fail(s"$argValue is not a valid choice for $name") case _ => - update(x, args) - catch case _: NumberFormatException => - fail(s"$argValue is not an integer argument for $name", args) + update(intValue, argValue, args) + .getOrElse: + state.fail(s"$argValue is not an integer argument for $name") def setOutput(argValue: String, args: List[String]) = val path = Directory(argValue) val isJar = path.ext.isJar - if (!isJar && !path.isDirectory) - fail(s"'$argValue' does not exist or is not a directory or .jar file", args) - else { - val output = if (isJar) JarArchive.create(path) else new PlainDirectory(path) - update(output, args) - } + if (!isJar && !path.isDirectory) then + state.fail(s"'$argValue' does not exist or is not a directory or .jar file") + else + /* Side effect, do not change this method to evaluate eagerly */ + def output = if (isJar) JarArchive.create(path) else new PlainDirectory(path) + update(output, argValue, args) def setVersion(argValue: String, args: List[String]) = - ScalaVersion.parse(argValue) match { - case Success(v) => update(v, args) - case Failure(ex) => fail(ex.getMessage, args) - } + ScalaVersion.parse(argValue) match + case Success(v) => update(v, argValue, args) + case Failure(ex) => state.fail(ex.getMessage) - def appendList(strings: List[String], args: List[String]) = + def appendList(strings: List[String], argValue: String, args: List[String]) = choices match case Some(valid) => strings.filterNot(valid.contains) match - case Nil => update(strings, args) + case Nil => update(strings, argValue, args) case invalid => invalidChoices(invalid) - case _ => update(strings, args) - + case _ => update(strings, argValue, args) def doSet(argRest: String) = - ((summon[ClassTag[T]], args): @unchecked) match { + ((summon[ClassTag[T]], args): @unchecked) match case (BooleanTag, _) => if sstate.wasChanged(idx) && preferPrevious then ignoreValue(args) else setBoolean(argRest, args) case (OptionTag, _) => - update(Some(propertyClass.get.getConstructor().newInstance()), args) + update(Some(propertyClass.get.getConstructor().newInstance()), "", args) case (ct, args) => val argInArgRest = !argRest.isEmpty || legacyArgs val argAfterParam = !argInArgRest && args.nonEmpty && (ct == IntTag || !args.head.startsWith("-")) @@ -214,12 +226,11 @@ object Settings: else if argAfterParam then doSetArg(args.head, args.tail) else missingArg - } def doSetArg(arg: String, argsLeft: List[String]) = summon[ClassTag[T]] match case ListTag => val strings = arg.split(",").toList - appendList(strings, argsLeft) + appendList(strings, arg, argsLeft) case StringTag => setString(arg, argsLeft) case OutputTag => @@ -241,14 +252,33 @@ object Settings: if(prefix.isEmpty) arg.dropWhile(_ != ':').drop(1) else arg.drop(prefix.get.length) if matches(arg) then - if deprecationMsg.isDefined then - warn(s"Option $name is deprecated: ${deprecationMsg.get}", args) - else - doSet(argValRest) - else - state - } - } + deprecation match + case Some(Deprecation(msg, _)) if ignoreInvalidArgs => // a special case for Xlint + state.deprecated(s"Option $name is deprecated: $msg") + case _ => doSet(argValRest) + else state + + end tryToSet + end Setting + + /** + * Class used for deprecating purposes. + * It contains all necessary information to deprecate given option. + * Scala Settings are considered deprecated when this object is present at their creation site. + * + * @param msg deprecation message that will be displayed in following format: s"Option $name is deprecated: $msg" + * @param replacedBy option that is substituting current option + */ + case class Deprecation( + msg: String, + replacedBy: Option[String] = None, + ) + + object Deprecation: + def renamed(replacement: String) = Some(Deprecation(s"Use $replacement instead.", Some(replacement))) + def removed(removedVersion: Option[String] = None) = + val msg = removedVersion.map(" in " + _).getOrElse(".") + Some(Deprecation(s"Scheduled for removal$msg", None)) object Setting: extension [T](setting: Setting[T]) @@ -269,7 +299,7 @@ object Settings: s"\n- $name${if description.isEmpty() then "" else s" :\n\t${description.replace("\n","\n\t")}"}" end Setting - class SettingGroup { + class SettingGroup: @unshared private val _allSettings = new ArrayBuffer[Setting[?]] @@ -287,11 +317,10 @@ object Settings: userSetSettings(state.sstate).foldLeft(state)(checkDependenciesOfSetting) private def checkDependenciesOfSetting(state: ArgsSummary, setting: Setting[?]) = - setting.depends.foldLeft(state) { (s, dep) => + setting.depends.foldLeft(state): (s, dep) => val (depSetting, reqValue) = dep if (depSetting.valueIn(state.sstate) == reqValue) s else s.fail(s"incomplete option ${setting.name} (requires ${depSetting.name})") - } /** Iterates over the arguments applying them to settings where applicable. * Then verifies setting dependencies are met. @@ -333,60 +362,57 @@ object Settings: def processArguments(arguments: List[String], processAll: Boolean, settingsState: SettingsState = defaultState): ArgsSummary = processArguments(ArgsSummary(settingsState, arguments, Nil, Nil), processAll, Nil) - def publish[T](settingf: Int => Setting[T]): Setting[T] = { + def publish[T](settingf: Int => Setting[T]): Setting[T] = val setting = settingf(_allSettings.length) _allSettings += setting setting - } def prependName(name: String): String = assert(!name.startsWith("-"), s"Setting $name cannot start with -") "-" + name - def BooleanSetting(category: SettingCategory, name: String, descr: String, initialValue: Boolean = false, aliases: List[String] = Nil, preferPrevious: Boolean = false): Setting[Boolean] = - publish(Setting(category, prependName(name), descr, initialValue, aliases = aliases, preferPrevious = preferPrevious)) + def BooleanSetting(category: SettingCategory, name: String, descr: String, initialValue: Boolean = false, aliases: List[String] = Nil, preferPrevious: Boolean = false, deprecation: Option[Deprecation] = None, ignoreInvalidArgs: Boolean = false): Setting[Boolean] = + publish(Setting(category, prependName(name), descr, initialValue, aliases = aliases, preferPrevious = preferPrevious, deprecation = deprecation, ignoreInvalidArgs = ignoreInvalidArgs)) - def StringSetting(category: SettingCategory, name: String, helpArg: String, descr: String, default: String, aliases: List[String] = Nil): Setting[String] = - publish(Setting(category, prependName(name), descr, default, helpArg, aliases = aliases)) + def StringSetting(category: SettingCategory, name: String, helpArg: String, descr: String, default: String, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[String] = + publish(Setting(category, prependName(name), descr, default, helpArg, aliases = aliases, deprecation = deprecation)) - def ChoiceSetting(category: SettingCategory, name: String, helpArg: String, descr: String, choices: List[String], default: String, aliases: List[String] = Nil, legacyArgs: Boolean = false): Setting[String] = - publish(Setting(category, prependName(name), descr, default, helpArg, Some(choices), aliases = aliases, legacyArgs = legacyArgs)) + def ChoiceSetting(category: SettingCategory, name: String, helpArg: String, descr: String, choices: List[String], default: String, aliases: List[String] = Nil, legacyArgs: Boolean = false, deprecation: Option[Deprecation] = None): Setting[String] = + publish(Setting(category, prependName(name), descr, default, helpArg, Some(choices), aliases = aliases, legacyArgs = legacyArgs, deprecation = deprecation)) - def MultiChoiceSetting(category: SettingCategory, name: String, helpArg: String, descr: String, choices: List[String], default: List[String], aliases: List[String] = Nil): Setting[List[String]] = - publish(Setting(category, prependName(name), descr, default, helpArg, Some(choices), aliases = aliases)) + def MultiChoiceSetting(category: SettingCategory, name: String, helpArg: String, descr: String, choices: List[String], default: List[String], aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[List[String]] = + publish(Setting(category, prependName(name), descr, default, helpArg, Some(choices), aliases = aliases, deprecation = deprecation)) - def MultiChoiceHelpSetting(category: SettingCategory, name: String, helpArg: String, descr: String, choices: List[ChoiceWithHelp[String]], default: List[ChoiceWithHelp[String]], aliases: List[String] = Nil): Setting[List[ChoiceWithHelp[String]]] = - publish(Setting(category, prependName(name), descr, default, helpArg, Some(choices), aliases = aliases)) + def MultiChoiceHelpSetting(category: SettingCategory, name: String, helpArg: String, descr: String, choices: List[ChoiceWithHelp[String]], default: List[ChoiceWithHelp[String]], aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[List[ChoiceWithHelp[String]]] = + publish(Setting(category, prependName(name), descr, default, helpArg, Some(choices), aliases = aliases, deprecation = deprecation)) - def IntSetting(category: SettingCategory, name: String, descr: String, default: Int, aliases: List[String] = Nil): Setting[Int] = - publish(Setting(category, prependName(name), descr, default, aliases = aliases)) + def IntSetting(category: SettingCategory, name: String, descr: String, default: Int, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[Int] = + publish(Setting(category, prependName(name), descr, default, aliases = aliases, deprecation = deprecation)) - def IntChoiceSetting(category: SettingCategory, name: String, descr: String, choices: Seq[Int], default: Int): Setting[Int] = - publish(Setting(category, prependName(name), descr, default, choices = Some(choices))) + def IntChoiceSetting(category: SettingCategory, name: String, descr: String, choices: Seq[Int], default: Int, deprecation: Option[Deprecation] = None): Setting[Int] = + publish(Setting(category, prependName(name), descr, default, choices = Some(choices), deprecation = deprecation)) - def MultiStringSetting(category: SettingCategory, name: String, helpArg: String, descr: String, default: List[String] = Nil, aliases: List[String] = Nil): Setting[List[String]] = - publish(Setting(category, prependName(name), descr, default, helpArg, aliases = aliases)) + def MultiStringSetting(category: SettingCategory, name: String, helpArg: String, descr: String, default: List[String] = Nil, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[List[String]] = + publish(Setting(category, prependName(name), descr, default, helpArg, aliases = aliases, deprecation = deprecation)) - def OutputSetting(category: SettingCategory, name: String, helpArg: String, descr: String, default: AbstractFile, aliases: List[String] = Nil, preferPrevious: Boolean = false): Setting[AbstractFile] = - publish(Setting(category, prependName(name), descr, default, helpArg, aliases = aliases, preferPrevious = preferPrevious)) + def OutputSetting(category: SettingCategory, name: String, helpArg: String, descr: String, default: AbstractFile, aliases: List[String] = Nil, preferPrevious: Boolean = false, deprecation: Option[Deprecation] = None): Setting[AbstractFile] = + publish(Setting(category, prependName(name), descr, default, helpArg, aliases = aliases, preferPrevious = preferPrevious, deprecation = deprecation)) - def PathSetting(category: SettingCategory, name: String, descr: String, default: String, aliases: List[String] = Nil): Setting[String] = - publish(Setting(category, prependName(name), descr, default, aliases = aliases)) + def PathSetting(category: SettingCategory, name: String, descr: String, default: String, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[String] = + publish(Setting(category, prependName(name), descr, default, aliases = aliases, deprecation = deprecation)) - def PhasesSetting(category: SettingCategory, name: String, descr: String, default: String = "", aliases: List[String] = Nil): Setting[List[String]] = - publish(Setting(category, prependName(name), descr, if (default.isEmpty) Nil else List(default), aliases = aliases)) + def PhasesSetting(category: SettingCategory, name: String, descr: String, default: String = "", aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[List[String]] = + publish(Setting(category, prependName(name), descr, if (default.isEmpty) Nil else List(default), aliases = aliases, deprecation = deprecation)) - def PrefixSetting(category: SettingCategory, name: String, descr: String): Setting[List[String]] = + def PrefixSetting(category: SettingCategory, name: String, descr: String, deprecation: Option[Deprecation] = None): Setting[List[String]] = val prefix = name.takeWhile(_ != '<') - publish(Setting(category, "-" + name, descr, Nil, prefix = Some(prefix))) + publish(Setting(category, "-" + name, descr, Nil, prefix = Some(prefix), deprecation = deprecation)) - def VersionSetting(category: SettingCategory, name: String, descr: String, default: ScalaVersion = NoScalaVersion, legacyArgs: Boolean = false): Setting[ScalaVersion] = - publish(Setting(category, prependName(name), descr, default, legacyArgs = legacyArgs)) + def VersionSetting(category: SettingCategory, name: String, descr: String, default: ScalaVersion = NoScalaVersion, legacyArgs: Boolean = false, deprecation: Option[Deprecation] = None): Setting[ScalaVersion] = + publish(Setting(category, prependName(name), descr, default, legacyArgs = legacyArgs, deprecation = deprecation)) - def OptionSetting[T: ClassTag](category: SettingCategory, name: String, descr: String, aliases: List[String] = Nil): Setting[Option[T]] = - publish(Setting(category, prependName(name), descr, None, propertyClass = Some(summon[ClassTag[T]].runtimeClass), aliases = aliases)) + def OptionSetting[T: ClassTag](category: SettingCategory, name: String, descr: String, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[Option[T]] = + publish(Setting(category, prependName(name), descr, None, propertyClass = Some(summon[ClassTag[T]].runtimeClass), aliases = aliases, deprecation = deprecation)) - def DeprecatedSetting(category: SettingCategory, name: String, descr: String, deprecationMsg: String): Setting[Boolean] = - publish(Setting(category, prependName(name), descr, false, deprecationMsg = Some(deprecationMsg))) - } + end SettingGroup end Settings diff --git a/compiler/src/dotty/tools/dotc/core/Phases.scala b/compiler/src/dotty/tools/dotc/core/Phases.scala index 89ea4dd6aa50..7f925b0fc322 100644 --- a/compiler/src/dotty/tools/dotc/core/Phases.scala +++ b/compiler/src/dotty/tools/dotc/core/Phases.scala @@ -349,15 +349,15 @@ object Phases { def subPhases: List[Run.SubPhase] = Nil final def traversals: Int = if subPhases.isEmpty then 1 else subPhases.length - /** skip the phase for a Java compilation unit, may depend on -Yjava-tasty */ + /** skip the phase for a Java compilation unit, may depend on -Xjava-tasty */ def skipIfJava(using Context): Boolean = true final def isAfterLastJavaPhase(using Context): Boolean = - // With `-Yjava-tasty` nominally the final phase is expected be ExtractAPI, + // With `-Xjava-tasty` nominally the final phase is expected be ExtractAPI, // otherwise drop Java sources at the end of TyperPhase. // Checks if the last Java phase is before this phase, // which always fails if the terminal phase is before lastJavaPhase. - val lastJavaPhase = if ctx.settings.YjavaTasty.value then sbtExtractAPIPhase else typerPhase + val lastJavaPhase = if ctx.settings.XjavaTasty.value then sbtExtractAPIPhase else typerPhase lastJavaPhase <= this /** @pre `isRunnable` returns true */ diff --git a/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala b/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala index fdc1ba9697d0..51e6a5e6138a 100644 --- a/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala +++ b/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala @@ -80,12 +80,12 @@ object SymbolLoaders { // offer a setting to resolve the conflict one way or the other. // This was motivated by the desire to use YourKit probes, which // require yjp.jar at runtime. See SI-2089. - if (ctx.settings.YtermConflict.value == "package" || ctx.mode.is(Mode.Interactive)) { + if (ctx.settings.XtermConflict.value == "package" || ctx.mode.is(Mode.Interactive)) { report.warning( s"Resolving package/object name conflict in favor of package ${preExisting.fullName}. The object will be inaccessible.") owner.asClass.delete(preExisting) } - else if (ctx.settings.YtermConflict.value == "object") { + else if (ctx.settings.XtermConflict.value == "object") { report.warning( s"Resolving package/object name conflict in favor of object ${preExisting.fullName}. The package will be inaccessible.") return NoSymbol @@ -470,7 +470,7 @@ class TastyLoader(val tastyFile: AbstractFile) extends SymbolLoader { new ClassfileTastyUUIDParser(classfile)(ctx).checkTastyUUID(tastyUUID) else // This will be the case in any of our tests that compile with `-Youtput-only-tasty`, or when - // tasty file compiled by `-Yearly-tasty-output-write` comes from an early output jar. + // tasty file compiled by `-Xearly-tasty-output-write` comes from an early output jar. report.inform(s"No classfiles found for $tastyFile when checking TASTy UUID") private def checkBeTastyUUID(tastyFile: AbstractFile, tastyBytes: Array[Byte])(using Context): Unit = diff --git a/compiler/src/dotty/tools/dotc/core/Symbols.scala b/compiler/src/dotty/tools/dotc/core/Symbols.scala index 7f6f13585efd..0020efa5018d 100644 --- a/compiler/src/dotty/tools/dotc/core/Symbols.scala +++ b/compiler/src/dotty/tools/dotc/core/Symbols.scala @@ -84,7 +84,7 @@ object Symbols extends SymUtils { ctx.settings.YretainTrees.value || denot.owner.isTerm || // no risk of leaking memory after a run for these denot.isOneOf(InlineOrProxy) || // need to keep inline info - ctx.settings.YcheckInit.value || // initialization check + ctx.settings.WcheckInit.value || // initialization check ctx.settings.YcheckInitGlobal.value /** The last denotation of this symbol */ diff --git a/compiler/src/dotty/tools/dotc/core/TypeErrors.scala b/compiler/src/dotty/tools/dotc/core/TypeErrors.scala index c71c20a38eb9..5b19fe0e7bdd 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeErrors.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeErrors.scala @@ -102,7 +102,7 @@ extends TypeError: em"""Recursion limit exceeded. |Maybe there is an illegal cyclic reference? |If that's not the case, you could also try to increase the stacksize using the -Xss JVM option. - |For the unprocessed stack trace, compile with -Yno-decode-stacktraces. + |For the unprocessed stack trace, compile with -Xno-decode-stacktraces. |A recurring operation is (inner to outer): |${opsString(mostCommon).stripMargin}""" @@ -122,7 +122,7 @@ object handleRecursive: e def apply(op: String, details: => String, exc: Throwable, weight: Int = 1)(using Context): Nothing = - if ctx.settings.YnoDecodeStacktraces.value then + if ctx.settings.XnoDecodeStacktraces.value then throw exc else exc match case _: RecursionOverflow => diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala index 4b2b218edb58..186e039c4d74 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala @@ -385,7 +385,7 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) { } catch case ex: Throwable => - if !ctx.settings.YnoDecodeStacktraces.value + if !ctx.settings.XnoDecodeStacktraces.value && handleRecursive.underlyingStackOverflowOrNull(ex) != null then throw StackSizeExceeded(mdef) else @@ -924,7 +924,7 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) { em"""Recursion limit exceeded while pickling ${ex.mdef} |in ${ex.mdef.symbol.showLocated}. |You could try to increase the stacksize using the -Xss JVM option. - |For the unprocessed stack trace, compile with -Yno-decode-stacktraces.""", + |For the unprocessed stack trace, compile with -Xno-decode-stacktraces.""", ex.mdef.srcPos) def missing = forwardSymRefs.keysIterator diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index 19c22c6bb3d0..04d19f2f8821 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -986,8 +986,8 @@ class TreeUnpickler(reader: TastyReader, if !sym.isType && !sym.is(ParamAccessor) then sym.info = ta.avoidPrivateLeaks(sym) - if (ctx.settings.YreadComments.value) { - assert(ctx.docCtx.isDefined, "`-Yread-docs` enabled, but no `docCtx` is set.") + if (ctx.settings.XreadComments.value) { + assert(ctx.docCtx.isDefined, "`-Xread-docs` enabled, but no `docCtx` is set.") commentUnpicklerOpt.foreach { commentUnpickler => val comment = commentUnpickler.commentAt(start) ctx.docCtx.get.addDocstring(tree.symbol, comment) diff --git a/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala b/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala index c1bd6b6778fd..18c5ceb5f346 100644 --- a/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala +++ b/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala @@ -19,7 +19,7 @@ class IDEDecompilerDriver(val settings: List[String]) extends dotc.Driver { private val myInitCtx: Context = { val rootCtx = initCtx.fresh.addMode(Mode.Interactive | Mode.ReadPositions) - rootCtx.setSetting(rootCtx.settings.YreadComments, true) + rootCtx.setSetting(rootCtx.settings.XreadComments, true) rootCtx.setSetting(rootCtx.settings.YretainTrees, true) rootCtx.setSetting(rootCtx.settings.fromTasty, true) val ctx = setup(settings.toArray :+ "dummy.scala", rootCtx).get._2 diff --git a/compiler/src/dotty/tools/dotc/fromtasty/ReadTasty.scala b/compiler/src/dotty/tools/dotc/fromtasty/ReadTasty.scala index 74010b3f64d1..f13bcdf00b34 100644 --- a/compiler/src/dotty/tools/dotc/fromtasty/ReadTasty.scala +++ b/compiler/src/dotty/tools/dotc/fromtasty/ReadTasty.scala @@ -48,11 +48,11 @@ class ReadTasty extends Phase { if (cls.rootTree.isEmpty) None else { val attributes = unpickler.tastyAttributes - if attributes.isJava && !ctx.settings.YjavaTasty.value then - // filter out Java compilation units if -Yjava-tasty is not set + if attributes.isJava && !ctx.settings.XjavaTasty.value then + // filter out Java compilation units if -Xjava-tasty is not set None - else if attributes.isOutline && !ctx.settings.YallowOutlineFromTasty.value then - cannotUnpickle("it contains outline signatures and -Yallow-outline-from-tasty is not set.") + else if attributes.isOutline && !ctx.settings.XallowOutlineFromTasty.value then + cannotUnpickle("it contains outline signatures and -Xallow-outline-from-tasty is not set.") else val unit = CompilationUnit(cls, cls.rootTree, forceTrees = true) unit.pickled += (cls -> (() => unpickler.unpickler.bytes)) diff --git a/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala b/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala index 8f42c62cb3b0..673874ae2769 100644 --- a/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala +++ b/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala @@ -33,8 +33,8 @@ class InteractiveDriver(val settings: List[String]) extends Driver { private val myInitCtx: Context = { val rootCtx = initCtx.fresh.addMode(Mode.ReadPositions).addMode(Mode.Interactive) rootCtx.setSetting(rootCtx.settings.YretainTrees, true) - rootCtx.setSetting(rootCtx.settings.YcookComments, true) - rootCtx.setSetting(rootCtx.settings.YreadComments, true) + rootCtx.setSetting(rootCtx.settings.XcookComments, true) + rootCtx.setSetting(rootCtx.settings.XreadComments, true) val ctx = setup(settings.toArray, rootCtx) match case Some((_, ctx)) => ctx case None => rootCtx diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 2f3daa79fb07..916fd2b30ed7 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -1614,7 +1614,7 @@ object Parsers { imods &~= Given syntaxError(em"context function types require at least one parameter", paramSpan) FunctionWithMods(params, resultType, imods, erasedArgs.toList) - else if !ctx.settings.YkindProjector.isDefault then + else if !ctx.settings.XkindProjector.isDefault then val (newParams :+ newResultType, tparams) = replaceKindProjectorPlaceholders(params :+ resultType): @unchecked lambdaAbstract(tparams, Function(newParams, newResultType)) else @@ -1741,7 +1741,7 @@ object Parsers { val isVarianceAnnotated = name.startsWith("+") || name.startsWith("-") // We remove the variance marker from the name without passing along the specified variance at all // The real variance will be inferred at a later stage but may contradict the variance specified, - // This is ok, because `-Ykind-projector` is for cross-compiling existing Scala 2 code, not for writing new code, + // This is ok, because `-Xkind-projector` is for cross-compiling existing Scala 2 code, not for writing new code, // we may assume that variance annotations have already been checked by the Scala 2 compiler. val unannotatedName = if (isVarianceAnnotated) name.mapLast(_.drop(1)) else name TypeDef(unannotatedName, WildcardTypeBoundsTree()).withFlags(Param) @@ -1758,7 +1758,7 @@ object Parsers { Ident(name) } - val uscores = ctx.settings.YkindProjector.value == "underscores" + val uscores = ctx.settings.XkindProjector.value == "underscores" val newParams = params.mapConserve { case param @ Ident(tpnme.raw.STAR | tpnme.raw.MINUS_STAR | tpnme.raw.PLUS_STAR) => addParam() case param @ Ident(tpnme.USCOREkw | tpnme.raw.MINUS_USCORE | tpnme.raw.PLUS_USCORE) if uscores => addParam() @@ -1944,7 +1944,7 @@ object Parsers { if isSimpleLiteral then SingletonTypeTree(simpleLiteral()) else if in.token == USCORE then - if ctx.settings.YkindProjector.value == "underscores" then + if ctx.settings.XkindProjector.value == "underscores" then val start = in.skipToken() Ident(tpnme.USCOREkw).withSpan(Span(start, in.lastOffset, start)) else @@ -1960,7 +1960,7 @@ object Parsers { typeBounds().withSpan(Span(start, in.lastOffset, start)) // Allow symbols -_ and +_ through for compatibility with code written using kind-projector in Scala 3 underscore mode. // While these signify variant type parameters in Scala 2 + kind-projector, we ignore their variance markers since variance is inferred. - else if (isIdent(nme.MINUS) || isIdent(nme.PLUS)) && in.lookahead.token == USCORE && ctx.settings.YkindProjector.value == "underscores" then + else if (isIdent(nme.MINUS) || isIdent(nme.PLUS)) && in.lookahead.token == USCORE && ctx.settings.XkindProjector.value == "underscores" then val identName = in.name.toTypeName ++ nme.USCOREkw val start = in.skipToken() in.nextToken() @@ -2012,7 +2012,7 @@ object Parsers { val applied = rejectWildcardType(t) val args = typeArgs(namedOK = false, wildOK = true) - if (!ctx.settings.YkindProjector.isDefault) { + if (!ctx.settings.XkindProjector.isDefault) { def fail(): Tree = { syntaxError( em"λ requires a single argument of the form X => ... or (X, Y) => ...", @@ -2044,7 +2044,7 @@ object Parsers { } }) case _ => - if (!ctx.settings.YkindProjector.isDefault) { + if (!ctx.settings.XkindProjector.isDefault) { t match { case Tuple(params) => val (newParams, tparams) = replaceKindProjectorPlaceholders(params) diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala index 3f9e8ca6532e..831d31d6fa6e 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala @@ -174,7 +174,7 @@ object Scanners { } class Scanner(source: SourceFile, override val startFrom: Offset = 0, profile: Profile = NoProfile, allowIndent: Boolean = true)(using Context) extends ScannerCommon(source) { - val keepComments = !ctx.settings.YdropComments.value + val keepComments = !ctx.settings.XdropComments.value /** A switch whether operators at the start of lines can be infix operators */ private[Scanners] var allowLeadingInfixOperators = true diff --git a/compiler/src/dotty/tools/dotc/report.scala b/compiler/src/dotty/tools/dotc/report.scala index 10b0023992fe..1d8ca5f208fa 100644 --- a/compiler/src/dotty/tools/dotc/report.scala +++ b/compiler/src/dotty/tools/dotc/report.scala @@ -146,7 +146,7 @@ object report: // Should only be called from Run#enrichErrorMessage. def enrichErrorMessage(errorMessage: String)(using Context): String = - if ctx.settings.YnoEnrichErrorMessages.value then errorMessage + if ctx.settings.XnoEnrichErrorMessages.value then errorMessage else try enrichErrorMessage1(errorMessage) catch case _: Throwable => errorMessage // don't introduce new errors trying to report errors, so swallow exceptions @@ -171,7 +171,7 @@ object report: | An unhandled exception was thrown in the compiler. | Please file a crash report here: | https://github.com/scala/scala3/issues/new/choose - | For non-enriched exceptions, compile with -Yno-enrich-error-messages. + | For non-enriched exceptions, compile with -Xno-enrich-error-messages. | |$info1 |""".stripMargin diff --git a/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala b/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala index 9bbac381efab..75f04908ac55 100644 --- a/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala +++ b/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala @@ -52,13 +52,13 @@ class ExtractAPI extends Phase { override def description: String = ExtractAPI.description override def isRunnable(using Context): Boolean = { - super.isRunnable && (ctx.runZincPhases || ctx.settings.YjavaTasty.value) + super.isRunnable && (ctx.runZincPhases || ctx.settings.XjavaTasty.value) } // Check no needed. Does not transform trees override def isCheckable: Boolean = false - // when `-Yjava-tasty` is set we actually want to run this phase on Java sources + // when `-Xjava-tasty` is set we actually want to run this phase on Java sources override def skipIfJava(using Context): Boolean = false // SuperAccessors need to be part of the API (see the scripted test @@ -79,8 +79,8 @@ class ExtractAPI extends Phase { units // still run the phase for the side effects (writing TASTy files to -Yearly-tasty-output) if doZincCallback then ctx.withIncCallback(recordNonLocalClasses(nonLocalClassSymbols, _)) - if ctx.settings.YjavaTasty.value then - units0.filterNot(_.typedAsJava) // remove java sources, this is the terminal phase when `-Yjava-tasty` is set + if ctx.settings.XjavaTasty.value then + units0.filterNot(_.typedAsJava) // remove java sources, this is the terminal phase when `-Xjava-tasty` is set else units0 end runOn diff --git a/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala b/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala index 352636f681c3..dfff5971889e 100644 --- a/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala +++ b/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala @@ -64,7 +64,7 @@ class ExtractDependencies extends Phase { // Check no needed. Does not transform trees override def isCheckable: Boolean = false - // when `-Yjava-tasty` is set we actually want to run this phase on Java sources + // when `-Xjava-tasty` is set we actually want to run this phase on Java sources override def skipIfJava(using Context): Boolean = false // This phase should be run directly after `Frontend`, if it is run after diff --git a/compiler/src/dotty/tools/dotc/transform/CookComments.scala b/compiler/src/dotty/tools/dotc/transform/CookComments.scala index d443e31fdc39..5dec0fff1e39 100644 --- a/compiler/src/dotty/tools/dotc/transform/CookComments.scala +++ b/compiler/src/dotty/tools/dotc/transform/CookComments.scala @@ -12,7 +12,7 @@ class CookComments extends MegaPhase.MiniPhase { override def description: String = CookComments.description override def transformTypeDef(tree: tpd.TypeDef)(using Context): tpd.Tree = { - if (ctx.settings.YcookComments.value && tree.isClassDef) { + if (ctx.settings.XcookComments.value && tree.isClassDef) { val cls = tree.symbol val cookingCtx = ctx.localContext(tree, cls).setNewScope val template = tree.rhs.asInstanceOf[tpd.Template] diff --git a/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala b/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala index c75ac9982317..217c843c4e50 100644 --- a/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala +++ b/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala @@ -445,7 +445,7 @@ object GenericSignatures { } } - private def needsJavaSig(tp: Type, throwsArgs: List[Type])(using Context): Boolean = !ctx.settings.YnoGenericSig.value && { + private def needsJavaSig(tp: Type, throwsArgs: List[Type])(using Context): Boolean = !ctx.settings.XnoGenericSig.value && { def needs(tp: Type) = (new NeedsSigCollector).apply(false, tp) needs(tp) || throwsArgs.exists(needs) } diff --git a/compiler/src/dotty/tools/dotc/transform/Pickler.scala b/compiler/src/dotty/tools/dotc/transform/Pickler.scala index 8bb396ca4081..6c3dcc669877 100644 --- a/compiler/src/dotty/tools/dotc/transform/Pickler.scala +++ b/compiler/src/dotty/tools/dotc/transform/Pickler.scala @@ -131,7 +131,7 @@ object Pickler { * that API and Dependency phases are complete. */ def init(using Context, ExecutionContext): AsyncTastyHolder = - AsyncTastyHolder(ctx.settings.YearlyTastyOutput.value, ctx.incCallback) + AsyncTastyHolder(ctx.settings.XearlyTastyOutput.value, ctx.incCallback) /** Asynchronously writes TASTy files to the destination -Yearly-tasty-output. @@ -198,7 +198,7 @@ class Pickler extends Phase { // we do not want to pickle `.betasty` if do not plan to actually create the // betasty file (as signified by the -Ybest-effort option) - // when `-Yjava-tasty` is set we actually want to run this phase on Java sources + // when `-Xjava-tasty` is set we actually want to run this phase on Java sources override def skipIfJava(using Context): Boolean = false private def output(name: String, msg: String) = { @@ -286,8 +286,8 @@ class Pickler extends Phase { util.SourceFile.relativePath(unit.source, reference) val isJavaAttr = unit.isJava // we must always set JAVAattr when pickling Java sources if isJavaAttr then - // assert that Java sources didn't reach Pickler without `-Yjava-tasty`. - assert(ctx.settings.YjavaTasty.value, "unexpected Java source file without -Yjava-tasty") + // assert that Java sources didn't reach Pickler without `-Xjava-tasty`. + assert(ctx.settings.XjavaTasty.value, "unexpected Java source file without -Xjava-tasty") val isOutline = isJavaAttr // TODO: later we may want outline for Scala sources too val attributes = Attributes( sourceFile = sourceRelativePath, @@ -326,7 +326,7 @@ class Pickler extends Phase { unit.source, tree :: Nil, positionWarnings, scratch.positionBuffer, scratch.pickledIndices) - if !ctx.settings.YdropComments.value then + if !ctx.settings.XdropComments.value then CommentPickler.pickleComments( pickler, treePkl.buf.addrOfTree, treePkl.docString, tree, scratch.commentBuffer) @@ -403,7 +403,7 @@ class Pickler extends Phase { runPhase(_()) if ctx.settings.YtestPickler.value then val ctx2 = ctx.fresh - .setSetting(ctx.settings.YreadComments, true) + .setSetting(ctx.settings.XreadComments, true) .setSetting(ctx.settings.YshowPrintErrors, true) testUnpickler( using ctx2 diff --git a/compiler/src/dotty/tools/dotc/transform/init/Checker.scala b/compiler/src/dotty/tools/dotc/transform/init/Checker.scala index 1a4141f3d495..9e78bd5474a3 100644 --- a/compiler/src/dotty/tools/dotc/transform/init/Checker.scala +++ b/compiler/src/dotty/tools/dotc/transform/init/Checker.scala @@ -29,7 +29,7 @@ class Checker extends Phase: override val runsAfter = Set(Pickler.name) override def isEnabled(using Context): Boolean = - super.isEnabled && (ctx.settings.YcheckInit.value || ctx.settings.YcheckInitGlobal.value) + super.isEnabled && (ctx.settings.WcheckInit.value || ctx.settings.YcheckInitGlobal.value) def traverse(traverser: InitTreeTraverser)(using Context): Boolean = monitor(phaseName): val unit = ctx.compilationUnit @@ -50,7 +50,7 @@ class Checker extends Phase: cancellable { val classes = traverser.getClasses() - if ctx.settings.YcheckInit.value then + if ctx.settings.WcheckInit.value then Semantic.checkClasses(classes)(using checkCtx) if ctx.settings.YcheckInitGlobal.value then diff --git a/compiler/src/dotty/tools/dotc/typer/TyperPhase.scala b/compiler/src/dotty/tools/dotc/typer/TyperPhase.scala index f7afc7a7e0a7..0c63f5b4ecb1 100644 --- a/compiler/src/dotty/tools/dotc/typer/TyperPhase.scala +++ b/compiler/src/dotty/tools/dotc/typer/TyperPhase.scala @@ -59,7 +59,7 @@ class TyperPhase(addRootImports: Boolean = true) extends Phase { } protected def discardAfterTyper(unit: CompilationUnit)(using Context): Boolean = - (unit.isJava && !ctx.settings.YjavaTasty.value) || unit.suspended + (unit.isJava && !ctx.settings.XjavaTasty.value) || unit.suspended override val subPhases: List[SubPhase] = List( SubPhase("indexing"), SubPhase("typechecking"), SubPhase("checkingJava")) diff --git a/compiler/src/dotty/tools/io/FileWriters.scala b/compiler/src/dotty/tools/io/FileWriters.scala index 87825b025734..b6338082c696 100644 --- a/compiler/src/dotty/tools/io/FileWriters.scala +++ b/compiler/src/dotty/tools/io/FileWriters.scala @@ -150,7 +150,7 @@ object FileWriters { object ReadOnlyContext: def readSettings(using ctx: Context): ReadOnlySettings = new: - val jarCompressionLevel = ctx.settings.YjarCompressionLevel.value + val jarCompressionLevel = ctx.settings.XjarCompressionLevel.value val debug = ctx.settings.Ydebug.value def readRun(using ctx: Context): ReadOnlyRun = new: diff --git a/compiler/src/dotty/tools/repl/ReplDriver.scala b/compiler/src/dotty/tools/repl/ReplDriver.scala index f8bba2f59fe1..121d00bcf8b3 100644 --- a/compiler/src/dotty/tools/repl/ReplDriver.scala +++ b/compiler/src/dotty/tools/repl/ReplDriver.scala @@ -82,8 +82,8 @@ class ReplDriver(settings: Array[String], /** Create a fresh and initialized context with IDE mode enabled */ private def initialCtx(settings: List[String]) = { val rootCtx = initCtx.fresh.addMode(Mode.ReadPositions | Mode.Interactive) - rootCtx.setSetting(rootCtx.settings.YcookComments, true) - rootCtx.setSetting(rootCtx.settings.YreadComments, true) + rootCtx.setSetting(rootCtx.settings.XcookComments, true) + rootCtx.setSetting(rootCtx.settings.XreadComments, true) setupRootCtx(this.settings ++ settings, rootCtx) } diff --git a/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala b/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala index eb300a0512b5..517adff17991 100644 --- a/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala +++ b/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala @@ -43,7 +43,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler import tpd.* private val xCheckMacro: Boolean = ctx.settings.XcheckMacros.value - private val yDebugMacro: Boolean = ctx.settings.YdebugMacros.value + private val yDebugMacro: Boolean = ctx.settings.XdebugMacros.value extension [T](self: scala.quoted.Expr[T]) def show: String = diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 2084b11d0b97..de3bd02bba6e 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -31,8 +31,8 @@ class CompilationTests { @Test def pos: Unit = { implicit val testGroup: TestGroup = TestGroup("compilePos") var tests = List( - compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Wunused:all", "-Wshadow:private-shadow", "-Wshadow:type-parameter-shadow"), FileFilter.include(TestSources.posLintingAllowlist)), - compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init"), FileFilter.exclude(TestSources.posLintingAllowlist)), + compileFilesInDir("tests/pos", defaultOptions.and("-Wsafe-init", "-Wunused:all", "-Wshadow:private-shadow", "-Wshadow:type-parameter-shadow"), FileFilter.include(TestSources.posLintingAllowlist)), + compileFilesInDir("tests/pos", defaultOptions.and("-Wsafe-init"), FileFilter.exclude(TestSources.posLintingAllowlist)), compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes), compileFilesInDir("tests/pos-special/sourcepath/outer", defaultOptions.and("-sourcepath", "tests/pos-special/sourcepath")), compileFile("tests/pos-special/sourcepath/outer/nested/Test4.scala", defaultOptions.and("-sourcepath", "tests/pos-special/sourcepath")), @@ -40,9 +40,9 @@ class CompilationTests { compileFilesInDir("tests/pos-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")), compileFile("tests/pos-special/utf8encoded.scala", defaultOptions.and("-encoding", "UTF8")), compileFile("tests/pos-special/utf16encoded.scala", defaultOptions.and("-encoding", "UTF16")), - compileDir("tests/pos-special/i18589", defaultOptions.and("-Ysafe-init").without("-Ycheck:all")), + compileDir("tests/pos-special/i18589", defaultOptions.and("-Wsafe-init").without("-Ycheck:all")), // Run tests for legacy lazy vals - compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.posLazyValsAllowlist)), + compileFilesInDir("tests/pos", defaultOptions.and("-Wsafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.posLazyValsAllowlist)), compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")), ) ::: ( // TODO create a folder for capture checking tests with the stdlib, or use tests/pos-custom-args/captures under this mode? @@ -51,7 +51,7 @@ class CompilationTests { ) if scala.util.Properties.isJavaAtLeast("16") then - tests ::= compileFilesInDir("tests/pos-java16+", defaultOptions.and("-Ysafe-init")) + tests ::= compileFilesInDir("tests/pos-java16+", defaultOptions.and("-Wsafe-init")) aggregateTests(tests*).checkCompile() } @@ -157,11 +157,11 @@ class CompilationTests { @Test def runAll: Unit = { implicit val testGroup: TestGroup = TestGroup("runAll") aggregateTests( - compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init")), + compileFilesInDir("tests/run", defaultOptions.and("-Wsafe-init")), compileFilesInDir("tests/run-deep-subtype", allowDeepSubtypes), compileFilesInDir("tests/run-custom-args/captures", allowDeepSubtypes.and("-language:experimental.captureChecking")), // Run tests for legacy lazy vals. - compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.runLazyValsAllowlist)), + compileFilesInDir("tests/run", defaultOptions.and("-Wsafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.runLazyValsAllowlist)), ).checkRuns() } @@ -225,9 +225,9 @@ class CompilationTests { // initialization tests @Test def checkInit: Unit = { implicit val testGroup: TestGroup = TestGroup("checkInit") - val options = defaultOptions.and("-Ysafe-init", "-Xfatal-warnings") + val options = defaultOptions.and("-Wsafe-init", "-Xfatal-warnings") compileFilesInDir("tests/init/neg", options).checkExpectedErrors() - compileFilesInDir("tests/init/warn", defaultOptions.and("-Ysafe-init")).checkWarnings() + compileFilesInDir("tests/init/warn", defaultOptions.and("-Wsafe-init")).checkWarnings() compileFilesInDir("tests/init/pos", options).checkCompile() compileFilesInDir("tests/init/crash", options.without("-Xfatal-warnings")).checkCompile() // The regression test for i12128 has some atypical classpath requirements. diff --git a/compiler/test/dotty/tools/dotc/SettingsTests.scala b/compiler/test/dotty/tools/dotc/SettingsTests.scala index 8125a80f29f8..301dc10ab54e 100644 --- a/compiler/test/dotty/tools/dotc/SettingsTests.scala +++ b/compiler/test/dotty/tools/dotc/SettingsTests.scala @@ -7,14 +7,19 @@ import reporting.StoreReporter import vulpix.TestConfiguration import core.Contexts.{Context, ContextBase} -import dotty.tools.dotc.config.Settings._ -import dotty.tools.dotc.config.ScalaSettingCategories._ +import dotty.tools.dotc.config.Settings.* +import dotty.tools.dotc.config.Settings.Setting.ChoiceWithHelp +import dotty.tools.dotc.config.ScalaSettingCategories.* import dotty.tools.vulpix.TestConfiguration.mkClasspath +import dotty.tools.io.PlainDirectory +import dotty.tools.io.Directory +import dotty.tools.dotc.config.ScalaVersion import java.nio.file._ import org.junit.Test import org.junit.Assert._ +import scala.util.Using class SettingsTests { @@ -199,6 +204,125 @@ class SettingsTests { assertEquals(List("Flag -qux set repeatedly"), summary.warnings) } + @Test def `Output setting is overriding existing jar`: Unit = + val result = Using.resource(Files.createTempFile("myfile", ".jar").nn){ file => + object Settings extends SettingGroup: + val defaultDir = new PlainDirectory(Directory(".")) + val testOutput = OutputSetting(RootSetting, "testOutput", "testOutput", "", defaultDir) + + import Settings._ + + Files.write(file, "test".getBytes()) + val fileStateBefore = String(Files.readAllBytes(file)) + + val args = List(s"-testOutput:${file.toString}") + val summary = processArguments(args, processAll = true) + + assertNotEquals(fileStateBefore, String(Files.readAllBytes(file)), "Jar should have been overriden") + + }(Files.deleteIfExists(_)) + + @Test def `Output setting is respecting previous setting`: Unit = + val result = Using.resources( + Files.createTempFile("myfile", ".jar").nn, Files.createTempFile("myfile2", ".jar").nn + ){ (file1, file2) => + object Settings extends SettingGroup: + val defaultDir = new PlainDirectory(Directory(".")) + val testOutput = OutputSetting(RootSetting, "testOutput", "testOutput", "", defaultDir, preferPrevious = true) + + import Settings._ + + Files.write(file1, "test1".getBytes()) + Files.write(file2, "test2".getBytes()) + + val file1StateBefore = String(Files.readAllBytes(file1)) + val file2StateBefore = String(Files.readAllBytes(file2)) + + val creationTime = Files.getLastModifiedTime(file1) + val args = List(s"-testOutput:${file1.toString}", s"-testOutput:${file2.toString}") + val summary = processArguments(args, processAll = true) + + // The output is a new filesystem without information of original path + // We can't check the `testOutput.value` as in other tests. + assertNotEquals(file1StateBefore, String(Files.readAllBytes(file1))) + assertEquals(file2StateBefore, String(Files.readAllBytes(file2))) + + }(Files.deleteIfExists(_), Files.deleteIfExists(_)) + + @Test def `Output side effect is not present when setting is deprecated`: Unit = + val result = Using.resource(Files.createTempFile("myfile", ".jar").nn){ file => + object Settings extends SettingGroup: + val defaultDir = new PlainDirectory(Directory(".")) + val testOutput = OutputSetting(RootSetting, "testOutput", "testOutput", "", defaultDir, preferPrevious = true, deprecation = Deprecation.renamed("XtestOutput")) + + import Settings._ + + Files.write(file, "test".getBytes()) + val fileStateBefore = String(Files.readAllBytes(file)) + + val args = List(s"-testOutput:${file.toString}") + val summary = processArguments(args, processAll = true) + + assertEquals(fileStateBefore, String(Files.readAllBytes(file))) + + }(Files.deleteIfExists(_)) + + @Test def `Arguments of flags are correctly parsed with both ":" and " " separating`: Unit = + object Settings extends SettingGroup: + val booleanSetting = BooleanSetting(RootSetting, "booleanSetting", "booleanSetting", false) + val stringSetting = StringSetting(RootSetting, "stringSetting", "stringSetting", "", "test") + val choiceSetting = ChoiceSetting(RootSetting, "choiceSetting", "choiceSetting", "", List("a", "b"), "a") + val multiChoiceSetting= MultiChoiceSetting(RootSetting, "multiChoiceSetting", "multiChoiceSetting", "", List("a", "b"), List()) + val multiChoiceHelpSetting= MultiChoiceHelpSetting(RootSetting, "multiChoiceHelpSetting", "multiChoiceHelpSetting", "", List(ChoiceWithHelp("a", "a"), ChoiceWithHelp("b", "b")), List()) + val intSetting = IntSetting(RootSetting, "intSetting", "intSetting", 0) + val intChoiceSetting = IntChoiceSetting(RootSetting, "intChoiceSetting", "intChoiceSetting", List(1,2,3), 1) + val multiStringSetting = MultiStringSetting(RootSetting, "multiStringSetting", "multiStringSetting", "", List("a", "b"), List()) + val outputSetting = OutputSetting(RootSetting, "outputSetting", "outputSetting", "", new PlainDirectory(Directory("."))) + val pathSetting = PathSetting(RootSetting, "pathSetting", "pathSetting", ".") + val phasesSetting = PhasesSetting(RootSetting, "phasesSetting", "phasesSetting", "all") + val versionSetting= VersionSetting(RootSetting, "versionSetting", "versionSetting") + + import Settings._ + Using.resource(Files.createTempDirectory("testDir")) { dir => + + val args = List( + List("-booleanSetting", "true"), + List("-stringSetting", "newTest"), + List("-choiceSetting", "b"), + List("-multiChoiceSetting", "a,b"), + List("-multiChoiceHelpSetting", "a,b"), + List("-intSetting", "42"), + List("-intChoiceSetting", "2"), + List("-multiStringSetting", "a,b"), + List("-outputSetting", dir.toString), + List("-pathSetting", dir.toString), + List("-phasesSetting", "parser,typer"), + List("-versionSetting", "1.0.0"), + ) + + def testValues(summary: ArgsSummary) = + withProcessedArgs(summary) { + assertEquals(true, booleanSetting.value) + assertEquals("newTest", stringSetting.value) + assertEquals("b", choiceSetting.value) + assertEquals(List("a", "b"), multiChoiceSetting.value) + assertEquals(List("a", "b"), multiChoiceHelpSetting.value) + assertEquals(42, intSetting.value) + assertEquals(2, intChoiceSetting.value) + assertEquals(List("a", "b"), multiStringSetting.value) + assertEquals(dir.toString, outputSetting.value.path) + assertEquals(dir.toString, pathSetting.value) + assertEquals(List("parser", "typer"), phasesSetting.value) + assertEquals(ScalaVersion.parse("1.0.0").get, versionSetting.value) + } + + val summaryColon = processArguments(args.map(_.mkString(":")), processAll = true) + val summaryWhitespace = processArguments(args.flatten, processAll = true) + testValues(summary = summaryColon) + testValues(summary = summaryWhitespace) + + }(Files.deleteIfExists(_)) + private def withProcessedArgs(summary: ArgsSummary)(f: SettingsState ?=> Unit) = f(using summary.sstate) extension [T](setting: Setting[T]) diff --git a/compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala b/compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala index b2de0d6423df..3dc4f4e4ec5e 100644 --- a/compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala +++ b/compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala @@ -13,6 +13,8 @@ import java.net.URI import java.nio.file.Files import scala.util.Using +import scala.annotation.nowarn + class ScalaSettingsTests: @Test def `A setting with aliases is accepted`: Unit = @@ -88,6 +90,105 @@ class ScalaSettingsTests: val nowr = new Diagnostic.Warning("This is a problem.".toMessage, util.NoSourcePosition) assertEquals(Action.Silent, sut.action(nowr)) + @nowarn("cat=deprecation") + @Test def `Deprecated options are correctly mapped to their replacements`: Unit = + def createTestCase(oldSetting: Setting[_], newSetting: Setting[_], value: String = "") = + s"${oldSetting.name}$value" -> newSetting + + val settings = ScalaSettings + List( + createTestCase(settings.YtermConflict , settings.XtermConflict, ":package"), + createTestCase(settings.YnoGenericSig , settings.XnoGenericSig), + createTestCase(settings.Ydumpclasses , settings.Xdumpclasses,":./"), + createTestCase(settings.YjarCompressionLevel , settings.XjarCompressionLevel,":0"), + createTestCase(settings.YkindProjector , settings.XkindProjector, ":underscores"), + createTestCase(settings.YdropComments , settings.XdropComments), + createTestCase(settings.YcookComments , settings.XcookComments), + createTestCase(settings.YreadComments , settings.XreadComments), + createTestCase(settings.YnoDecodeStacktraces , settings.XnoDecodeStacktraces), + createTestCase(settings.YnoEnrichErrorMessages, settings.XnoEnrichErrorMessages), + createTestCase(settings.YdebugMacros , settings.XdebugMacros), + // createTestCase(settings.YjavaTasty , settings.XjavaTasty), + // createTestCase(settings.YearlyTastyOutput , settings.XearlyTastyOutput, ":./"), + // createTestCase(settings.YallowOutlineFromTasty, settings.XallowOutlineFromTasty), + createTestCase(settings.YcheckInit , settings.WcheckInit), + // createTestCase(settings.Xlint , settings.Wshadow, ":all"), // this setting is not going to be mapped to replacement. Read more in the commit message + ).map: (deprecatedArgument, newSetting) => + val args = List(deprecatedArgument) + val argSummary = ArgsSummary(settings.defaultState, args, errors = Nil, warnings = Nil) + val conf = settings.processArguments(argSummary, processAll = true, skipped = Nil) + assert(!newSetting.isDefaultIn(conf.sstate), s"Setting $deprecatedArgument was not forwarded to ${newSetting.name}") + + @nowarn("cat=deprecation") + @Test def `Deprecated options should not be set if old option was incorrect`: Unit = + def createTestCase(oldSetting: Setting[_], newSetting: Setting[_], value: String = ":illegal") = + s"${oldSetting.name}:$value" -> newSetting + + val settings = ScalaSettings + List( + createTestCase(settings.YtermConflict , settings.XtermConflict), + createTestCase(settings.YnoGenericSig , settings.XnoGenericSig), + createTestCase(settings.Ydumpclasses , settings.Xdumpclasses, ""), + createTestCase(settings.YjarCompressionLevel , settings.XjarCompressionLevel), + createTestCase(settings.YkindProjector , settings.XkindProjector), + createTestCase(settings.YdropComments , settings.XdropComments), + createTestCase(settings.YcookComments , settings.XcookComments), + createTestCase(settings.YreadComments , settings.XreadComments), + createTestCase(settings.YnoDecodeStacktraces , settings.XnoDecodeStacktraces), + createTestCase(settings.YnoEnrichErrorMessages, settings.XnoEnrichErrorMessages), + createTestCase(settings.YdebugMacros , settings.XdebugMacros), + // createTestCase(settings.YjavaTasty , settings.XjavaTasty), + // createTestCase(settings.YearlyTastyOutput , settings.XearlyTastyOutput), + // createTestCase(settings.YallowOutlineFromTasty, settings.XallowOutlineFromTasty), + createTestCase(settings.YcheckInit , settings.WcheckInit), + createTestCase(settings.Xlint , settings.Wshadow), + ).map: (deprecatedArgument, newSetting) => + val args = List(deprecatedArgument) + val argSummary = ArgsSummary(settings.defaultState, args, errors = Nil, warnings = Nil) + val conf = settings.processArguments(argSummary, processAll = true, skipped = Nil) + assert(newSetting.isDefaultIn(conf.sstate), s"Setting $deprecatedArgument was forwarded to ${newSetting.name}, when it should be ignored because first option was erroreus") + + // -Xlint was handled in a special way when it was added, making in hard to deprecate it. + // For now on we will retain old behavior, in next version we will emit deprecation warning. + // It is also scheduled for removal in future versions. + @Test def `Make Xlint to ignore invalid args`: Unit = + val settings = ScalaSettings + val args = List("-Xlint:-unused,_") + val argSummary = ArgsSummary(settings.defaultState, args, errors = Nil, warnings = Nil) + val conf = settings.processArguments(argSummary, processAll = true, skipped = Nil) + assert(conf.warnings.contains("Option -Xlint is deprecated: Use -Wshadow to enable shadowing lints. Scheduled for removal.")) + assert(conf.errors.isEmpty) + + @nowarn("cat=deprecation") + @Test def `Deprecated options aliases are correctly mapped to their replacements`: Unit = + def createTestCase(oldSetting: Setting[_], newSetting: Setting[_], value: String = "") = + oldSetting.aliases.map: alias => + s"$alias$value" -> newSetting + + val settings = ScalaSettings + List( + createTestCase(settings.YtermConflict , settings.XtermConflict, ":package"), + createTestCase(settings.YnoGenericSig , settings.XnoGenericSig), + createTestCase(settings.Ydumpclasses , settings.Xdumpclasses,":./"), + createTestCase(settings.YjarCompressionLevel , settings.XjarCompressionLevel,":0"), + createTestCase(settings.YkindProjector , settings.XkindProjector, ":underscores"), + createTestCase(settings.YdropComments , settings.XdropComments), + createTestCase(settings.YcookComments , settings.XcookComments), + createTestCase(settings.YreadComments , settings.XreadComments), + createTestCase(settings.YnoDecodeStacktraces , settings.XnoDecodeStacktraces), + createTestCase(settings.YnoEnrichErrorMessages, settings.XnoEnrichErrorMessages), + createTestCase(settings.YdebugMacros , settings.XdebugMacros), + // createTestCase(settings.YjavaTasty , settings.XjavaTasty), + // createTestCase(settings.YearlyTastyOutput , settings.XearlyTastyOutput, ":./"), + // createTestCase(settings.YallowOutlineFromTasty, settings.XallowOutlineFromTasty), + createTestCase(settings.YcheckInit , settings.WcheckInit), + // createTestCase(settings.Xlint , settings.Wshadow, ":all"), // this setting is not going to be mapped to replacement. Read more in the commit message + ).flatten.map: (deprecatedArgument, newSetting) => + val args = List(deprecatedArgument) + val argSummary = ArgsSummary(settings.defaultState, args, errors = Nil, warnings = Nil) + val conf = settings.processArguments(argSummary, processAll = true, skipped = Nil) + assert(!newSetting.isDefaultIn(conf.sstate), s"Setting alias $deprecatedArgument was not forwarded to ${newSetting.name}") + @Test def `i18367 rightmost WConf flags take precedence over flags to the left`: Unit = import reporting.{Action, Diagnostic} val sets = ScalaSettings diff --git a/compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala b/compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala index 11406070ce7a..072944da1349 100644 --- a/compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala +++ b/compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala @@ -110,7 +110,7 @@ class CommentPicklingTest { private class UnpicklingDriver extends Driver { override def initCtx = val ctx = super.initCtx.fresh - ctx.setSetting(ctx.settings.YreadComments, true) + ctx.setSetting(ctx.settings.XreadComments, true) ctx def unpickle[T](args: Array[String], files: List[File])(fn: (List[tpd.Tree], Context) => T): T = { diff --git a/docs/_docs/reference/experimental/explicit-nulls.md b/docs/_docs/reference/experimental/explicit-nulls.md index bcbea34dd18d..50339c3fa1e4 100644 --- a/docs/_docs/reference/experimental/explicit-nulls.md +++ b/docs/_docs/reference/experimental/explicit-nulls.md @@ -85,7 +85,7 @@ val c = new C() // c.f == "field is null" ``` -The unsoundness above can be caught by the compiler with the option `-Ysafe-init`. +The unsoundness above can be caught by the compiler with the option `-Wsafe-init`. More details can be found in [safe initialization](../other-new-features/safe-initialization.md). ## Equality diff --git a/docs/_docs/reference/other-new-features/safe-initialization.md b/docs/_docs/reference/other-new-features/safe-initialization.md index 757038eac786..503dbc7bde47 100644 --- a/docs/_docs/reference/other-new-features/safe-initialization.md +++ b/docs/_docs/reference/other-new-features/safe-initialization.md @@ -4,7 +4,7 @@ title: "Safe Initialization" nightlyOf: https://docs.scala-lang.org/scala3/reference/other-new-features/safe-initialization.html --- -Scala 3 implements experimental safe initialization check, which can be enabled by the compiler option `-Ysafe-init`. +Scala 3 implements experimental safe initialization check, which can be enabled by the compiler option `-Wsafe-init`. The design and implementation of the initialization checker is described in the paper _Safe object initialization, abstractly_ [3]. diff --git a/docs/_spec/TODOreference/other-new-features/safe-initialization.md b/docs/_spec/TODOreference/other-new-features/safe-initialization.md index 757038eac786..503dbc7bde47 100644 --- a/docs/_spec/TODOreference/other-new-features/safe-initialization.md +++ b/docs/_spec/TODOreference/other-new-features/safe-initialization.md @@ -4,7 +4,7 @@ title: "Safe Initialization" nightlyOf: https://docs.scala-lang.org/scala3/reference/other-new-features/safe-initialization.html --- -Scala 3 implements experimental safe initialization check, which can be enabled by the compiler option `-Ysafe-init`. +Scala 3 implements experimental safe initialization check, which can be enabled by the compiler option `-Wsafe-init`. The design and implementation of the initialization checker is described in the paper _Safe object initialization, abstractly_ [3]. diff --git a/project/Build.scala b/project/Build.scala index aaa16ce4bce4..350471cc3e12 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -602,8 +602,8 @@ object Build { // Settings shared between scala3-compiler and scala3-compiler-bootstrapped lazy val commonDottyCompilerSettings = Seq( - // Note: bench/profiles/projects.yml should be updated accordingly. - Compile / scalacOptions ++= Seq("-Yexplicit-nulls", "-Ysafe-init"), + // Note: bench/profiles/projects.yml should be updated accordingly. + Compile / scalacOptions ++= Seq("-Yexplicit-nulls"), // Use source 3.3 to avoid fatal migration warnings on scalajs-ir scalacOptions ++= Seq("-source", "3.3"), @@ -880,6 +880,8 @@ object Build { } lazy val nonBootstrappedDottyCompilerSettings = commonDottyCompilerSettings ++ Seq( + // FIXME revert this to commonDottyCompilerSettings, when we bump reference version to 3.5.0 + scalacOptions += "-Ysafe-init", // packageAll packages all and then returns a map with the abs location packageAll := Def.taskDyn { // Use a dynamic task to avoid loops when loading the settings Def.task { @@ -907,6 +909,8 @@ object Build { ) lazy val bootstrappedDottyCompilerSettings = commonDottyCompilerSettings ++ Seq( + // FIXME revert this to commonDottyCompilerSettings, when we bump reference version to 3.5.0 + scalacOptions += "-Wsafe-init", javaOptions ++= { val jars = packageAll.value Seq( @@ -1334,7 +1338,7 @@ object Build { BuildInfoPlugin.buildInfoScopedSettings(Test) ++ BuildInfoPlugin.buildInfoDefaultSettings - lazy val presentationCompilerSettings = { + def presentationCompilerSettings(implicit mode: Mode) = { val mtagsVersion = "1.3.0+56-a06a024d-SNAPSHOT" Seq( @@ -1348,7 +1352,11 @@ object Build { ivyConfigurations += SourceDeps.hide, transitiveClassifiers := Seq("sources"), scalacOptions ++= Seq("-source", "3.3"), // To avoid fatal migration warnings - Compile / scalacOptions ++= Seq("-Yexplicit-nulls", "-Ysafe-init"), + // FIXME change this to just Seq("-Yexplicit-nulls, "-Wsafe-init") when reference is set to 3.5.0 + Compile / scalacOptions ++= (mode match { + case Bootstrapped => Seq("-Yexplicit-nulls", "-Wsafe-init") + case NonBootstrapped => Seq("-Yexplicit-nulls", "-Ysafe-init") + }), Compile / sourceGenerators += Def.task { val s = streams.value val cacheDir = s.cacheDirectory diff --git a/sbt-test/pipelining/Yearly-tasty-output-inline/a/src/main/scala/a/A.scala b/sbt-test/pipelining/Xearly-tasty-output-inline/a/src/main/scala/a/A.scala similarity index 100% rename from sbt-test/pipelining/Yearly-tasty-output-inline/a/src/main/scala/a/A.scala rename to sbt-test/pipelining/Xearly-tasty-output-inline/a/src/main/scala/a/A.scala diff --git a/sbt-test/pipelining/Yearly-tasty-output-inline/b/src/main/scala/b/B.scala b/sbt-test/pipelining/Xearly-tasty-output-inline/b/src/main/scala/b/B.scala similarity index 100% rename from sbt-test/pipelining/Yearly-tasty-output-inline/b/src/main/scala/b/B.scala rename to sbt-test/pipelining/Xearly-tasty-output-inline/b/src/main/scala/b/B.scala diff --git a/sbt-test/pipelining/Yearly-tasty-output-inline/build.sbt b/sbt-test/pipelining/Xearly-tasty-output-inline/build.sbt similarity index 90% rename from sbt-test/pipelining/Yearly-tasty-output-inline/build.sbt rename to sbt-test/pipelining/Xearly-tasty-output-inline/build.sbt index e350fa7e7def..8ca1f4df759e 100644 --- a/sbt-test/pipelining/Yearly-tasty-output-inline/build.sbt +++ b/sbt-test/pipelining/Xearly-tasty-output-inline/build.sbt @@ -4,7 +4,7 @@ // defines a inline method. lazy val a = project.in(file("a")) .settings( - scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-early.jar").toString), + scalacOptions ++= Seq("-Xearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-early.jar").toString), scalacOptions += "-Ycheck:all", ) diff --git a/sbt-test/pipelining/Yearly-tasty-output-inline/project/DottyInjectedPlugin.scala b/sbt-test/pipelining/Xearly-tasty-output-inline/project/DottyInjectedPlugin.scala similarity index 100% rename from sbt-test/pipelining/Yearly-tasty-output-inline/project/DottyInjectedPlugin.scala rename to sbt-test/pipelining/Xearly-tasty-output-inline/project/DottyInjectedPlugin.scala diff --git a/sbt-test/pipelining/Yearly-tasty-output-inline/test b/sbt-test/pipelining/Xearly-tasty-output-inline/test similarity index 100% rename from sbt-test/pipelining/Yearly-tasty-output-inline/test rename to sbt-test/pipelining/Xearly-tasty-output-inline/test diff --git a/sbt-test/pipelining/Yearly-tasty-output/a/src/main/scala/a/A.scala b/sbt-test/pipelining/Xearly-tasty-output/a/src/main/scala/a/A.scala similarity index 100% rename from sbt-test/pipelining/Yearly-tasty-output/a/src/main/scala/a/A.scala rename to sbt-test/pipelining/Xearly-tasty-output/a/src/main/scala/a/A.scala diff --git a/sbt-test/pipelining/Yearly-tasty-output/b-early-out/.keep b/sbt-test/pipelining/Xearly-tasty-output/b-early-out/.keep similarity index 100% rename from sbt-test/pipelining/Yearly-tasty-output/b-early-out/.keep rename to sbt-test/pipelining/Xearly-tasty-output/b-early-out/.keep diff --git a/sbt-test/pipelining/Yearly-tasty-output/b/src/main/scala/b/B.scala b/sbt-test/pipelining/Xearly-tasty-output/b/src/main/scala/b/B.scala similarity index 100% rename from sbt-test/pipelining/Yearly-tasty-output/b/src/main/scala/b/B.scala rename to sbt-test/pipelining/Xearly-tasty-output/b/src/main/scala/b/B.scala diff --git a/sbt-test/pipelining/Yearly-tasty-output/build.sbt b/sbt-test/pipelining/Xearly-tasty-output/build.sbt similarity index 87% rename from sbt-test/pipelining/Yearly-tasty-output/build.sbt rename to sbt-test/pipelining/Xearly-tasty-output/build.sbt index 5cfe30936ea9..739f6cc8c31e 100644 --- a/sbt-test/pipelining/Yearly-tasty-output/build.sbt +++ b/sbt-test/pipelining/Xearly-tasty-output/build.sbt @@ -4,14 +4,14 @@ // early out is a jar lazy val a = project.in(file("a")) .settings( - scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-early.jar").toString), + scalacOptions ++= Seq("-Xearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-early.jar").toString), scalacOptions += "-Ycheck:all", ) // early out is a directory lazy val b = project.in(file("b")) .settings( - scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "b-early-out").toString), + scalacOptions ++= Seq("-Xearly-tasty-output", ((ThisBuild / baseDirectory).value / "b-early-out").toString), scalacOptions += "-Ycheck:all", ) diff --git a/sbt-test/pipelining/Yearly-tasty-output/c/src/main/scala/c/C.scala b/sbt-test/pipelining/Xearly-tasty-output/c/src/main/scala/c/C.scala similarity index 100% rename from sbt-test/pipelining/Yearly-tasty-output/c/src/main/scala/c/C.scala rename to sbt-test/pipelining/Xearly-tasty-output/c/src/main/scala/c/C.scala diff --git a/sbt-test/pipelining/Yearly-tasty-output/project/DottyInjectedPlugin.scala b/sbt-test/pipelining/Xearly-tasty-output/project/DottyInjectedPlugin.scala similarity index 100% rename from sbt-test/pipelining/Yearly-tasty-output/project/DottyInjectedPlugin.scala rename to sbt-test/pipelining/Xearly-tasty-output/project/DottyInjectedPlugin.scala diff --git a/sbt-test/pipelining/Yearly-tasty-output/test b/sbt-test/pipelining/Xearly-tasty-output/test similarity index 100% rename from sbt-test/pipelining/Yearly-tasty-output/test rename to sbt-test/pipelining/Xearly-tasty-output/test diff --git a/sbt-test/pipelining/Yjava-tasty-annotation/a/src/main/scala/a/A.java b/sbt-test/pipelining/Xjava-tasty-annotation/a/src/main/scala/a/A.java similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-annotation/a/src/main/scala/a/A.java rename to sbt-test/pipelining/Xjava-tasty-annotation/a/src/main/scala/a/A.java diff --git a/sbt-test/pipelining/Yjava-tasty-annotation/a/src/main/scala/a/package.scala b/sbt-test/pipelining/Xjava-tasty-annotation/a/src/main/scala/a/package.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-annotation/a/src/main/scala/a/package.scala rename to sbt-test/pipelining/Xjava-tasty-annotation/a/src/main/scala/a/package.scala diff --git a/sbt-test/pipelining/Yjava-tasty-annotation/b-alt/.keep b/sbt-test/pipelining/Xjava-tasty-annotation/b-alt/.keep similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-annotation/b-alt/.keep rename to sbt-test/pipelining/Xjava-tasty-annotation/b-alt/.keep diff --git a/sbt-test/pipelining/Yjava-tasty-annotation/b/src/main/scala/b/B.scala b/sbt-test/pipelining/Xjava-tasty-annotation/b/src/main/scala/b/B.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-annotation/b/src/main/scala/b/B.scala rename to sbt-test/pipelining/Xjava-tasty-annotation/b/src/main/scala/b/B.scala diff --git a/sbt-test/pipelining/Yjava-tasty-annotation/build.sbt b/sbt-test/pipelining/Xjava-tasty-annotation/build.sbt similarity index 87% rename from sbt-test/pipelining/Yjava-tasty-annotation/build.sbt rename to sbt-test/pipelining/Xjava-tasty-annotation/build.sbt index 20a13d7d4ba0..440ef8eced59 100644 --- a/sbt-test/pipelining/Yjava-tasty-annotation/build.sbt +++ b/sbt-test/pipelining/Xjava-tasty-annotation/build.sbt @@ -1,7 +1,7 @@ lazy val a = project.in(file("a")) .settings( - scalacOptions += "-Yjava-tasty", // enable pickling of java signatures - scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-annotation-java-tasty.jar").toString), + scalacOptions += "-Xjava-tasty", // enable pickling of java signatures + scalacOptions ++= Seq("-Xearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-annotation-java-tasty.jar").toString), scalacOptions += "-Ycheck:all", Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a-annotation-classes"), // send classfiles to a different directory ) diff --git a/sbt-test/pipelining/Yjava-tasty-annotation/project/DottyInjectedPlugin.scala b/sbt-test/pipelining/Xjava-tasty-annotation/project/DottyInjectedPlugin.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-annotation/project/DottyInjectedPlugin.scala rename to sbt-test/pipelining/Xjava-tasty-annotation/project/DottyInjectedPlugin.scala diff --git a/sbt-test/pipelining/Yjava-tasty-annotation/test b/sbt-test/pipelining/Xjava-tasty-annotation/test similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-annotation/test rename to sbt-test/pipelining/Xjava-tasty-annotation/test diff --git a/sbt-test/pipelining/Yjava-tasty-enum/a/src/main/scala/a/A.java b/sbt-test/pipelining/Xjava-tasty-enum/a/src/main/scala/a/A.java similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-enum/a/src/main/scala/a/A.java rename to sbt-test/pipelining/Xjava-tasty-enum/a/src/main/scala/a/A.java diff --git a/sbt-test/pipelining/Yjava-tasty-enum/a/src/main/scala/a/package.scala b/sbt-test/pipelining/Xjava-tasty-enum/a/src/main/scala/a/package.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-enum/a/src/main/scala/a/package.scala rename to sbt-test/pipelining/Xjava-tasty-enum/a/src/main/scala/a/package.scala diff --git a/sbt-test/pipelining/Yjava-tasty-enum/b-alt/.keep b/sbt-test/pipelining/Xjava-tasty-enum/b-alt/.keep similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-enum/b-alt/.keep rename to sbt-test/pipelining/Xjava-tasty-enum/b-alt/.keep diff --git a/sbt-test/pipelining/Yjava-tasty-enum/b/src/main/scala/b/B.scala b/sbt-test/pipelining/Xjava-tasty-enum/b/src/main/scala/b/B.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-enum/b/src/main/scala/b/B.scala rename to sbt-test/pipelining/Xjava-tasty-enum/b/src/main/scala/b/B.scala diff --git a/sbt-test/pipelining/Yjava-tasty-enum/build.sbt b/sbt-test/pipelining/Xjava-tasty-enum/build.sbt similarity index 92% rename from sbt-test/pipelining/Yjava-tasty-enum/build.sbt rename to sbt-test/pipelining/Xjava-tasty-enum/build.sbt index 2083003d9ebe..5adbe6ec992e 100644 --- a/sbt-test/pipelining/Yjava-tasty-enum/build.sbt +++ b/sbt-test/pipelining/Xjava-tasty-enum/build.sbt @@ -1,8 +1,8 @@ lazy val a = project.in(file("a")) .settings( compileOrder := CompileOrder.Mixed, // ensure we send java sources to Scala compiler - scalacOptions += "-Yjava-tasty", // enable pickling of java signatures - scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty.jar").toString), + scalacOptions += "-Xjava-tasty", // enable pickling of java signatures + scalacOptions ++= Seq("-Xearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty.jar").toString), scalacOptions += "-Ycheck:all", Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a-enum-classes"), // send classfiles to a different directory ) diff --git a/sbt-test/pipelining/Yjava-tasty-enum/project/DottyInjectedPlugin.scala b/sbt-test/pipelining/Xjava-tasty-enum/project/DottyInjectedPlugin.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-enum/project/DottyInjectedPlugin.scala rename to sbt-test/pipelining/Xjava-tasty-enum/project/DottyInjectedPlugin.scala diff --git a/sbt-test/pipelining/Yjava-tasty-enum/test b/sbt-test/pipelining/Xjava-tasty-enum/test similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-enum/test rename to sbt-test/pipelining/Xjava-tasty-enum/test diff --git a/sbt-test/pipelining/Yjava-tasty-from-tasty/a/src/main/scala/a/A.java b/sbt-test/pipelining/Xjava-tasty-from-tasty/a/src/main/scala/a/A.java similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-from-tasty/a/src/main/scala/a/A.java rename to sbt-test/pipelining/Xjava-tasty-from-tasty/a/src/main/scala/a/A.java diff --git a/sbt-test/pipelining/Yjava-tasty-from-tasty/a/src/main/scala/a/package.scala b/sbt-test/pipelining/Xjava-tasty-from-tasty/a/src/main/scala/a/package.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-from-tasty/a/src/main/scala/a/package.scala rename to sbt-test/pipelining/Xjava-tasty-from-tasty/a/src/main/scala/a/package.scala diff --git a/sbt-test/pipelining/Yjava-tasty-from-tasty/a_from_tasty/.keep b/sbt-test/pipelining/Xjava-tasty-from-tasty/a_from_tasty/.keep similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-from-tasty/a_from_tasty/.keep rename to sbt-test/pipelining/Xjava-tasty-from-tasty/a_from_tasty/.keep diff --git a/sbt-test/pipelining/Yjava-tasty-from-tasty/b-alt/.keep b/sbt-test/pipelining/Xjava-tasty-from-tasty/b-alt/.keep similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-from-tasty/b-alt/.keep rename to sbt-test/pipelining/Xjava-tasty-from-tasty/b-alt/.keep diff --git a/sbt-test/pipelining/Yjava-tasty-from-tasty/b/src/main/scala/b/B.scala b/sbt-test/pipelining/Xjava-tasty-from-tasty/b/src/main/scala/b/B.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-from-tasty/b/src/main/scala/b/B.scala rename to sbt-test/pipelining/Xjava-tasty-from-tasty/b/src/main/scala/b/B.scala diff --git a/sbt-test/pipelining/Yjava-tasty-from-tasty/build.sbt b/sbt-test/pipelining/Xjava-tasty-from-tasty/build.sbt similarity index 87% rename from sbt-test/pipelining/Yjava-tasty-from-tasty/build.sbt rename to sbt-test/pipelining/Xjava-tasty-from-tasty/build.sbt index 040c3bf6eac8..3876ce28693d 100644 --- a/sbt-test/pipelining/Yjava-tasty-from-tasty/build.sbt +++ b/sbt-test/pipelining/Xjava-tasty-from-tasty/build.sbt @@ -2,22 +2,22 @@ lazy val a = project.in(file("a")) .settings( compileOrder := CompileOrder.Mixed, // ensure we send java sources to Scala compiler - scalacOptions += "-Yjava-tasty", // enable pickling of java signatures - scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-pre-java-tasty.jar").toString), + scalacOptions += "-Xjava-tasty", // enable pickling of java signatures + scalacOptions ++= Seq("-Xearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-pre-java-tasty.jar").toString), scalacOptions += "-Ycheck:all", Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a-pre-classes"), // send classfiles to a different directory ) // recompile `a` with `-from-tasty` flag to test idempotent read/write java signatures. -// Requires -Yjava-tasty to be set in order to read them. +// Requires -Xjava-tasty to be set in order to read them. lazy val a_from_tasty = project.in(file("a_from_tasty")) .settings( Compile / sources := Seq((ThisBuild / baseDirectory).value / "a-pre-java-tasty.jar"), Compile / unmanagedClasspath := Seq(Attributed.blank((ThisBuild / baseDirectory).value / "a-pre-java-tasty.jar")), scalacOptions += "-from-tasty", // read the jar file tasties as the source files - scalacOptions += "-Yjava-tasty", - scalacOptions += "-Yallow-outline-from-tasty", // allow outline signatures to be read with -from-tasty - scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a_from_tasty-java-tasty.jar").toString), + scalacOptions += "-Xjava-tasty", + scalacOptions += "-Xallow-outline-from-tasty", // allow outline signatures to be read with -from-tasty + scalacOptions ++= Seq("-Xearly-tasty-output", ((ThisBuild / baseDirectory).value / "a_from_tasty-java-tasty.jar").toString), scalacOptions += "-Ycheck:all", Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a_from_tasty-classes"), // send classfiles to a different directory ) diff --git a/sbt-test/pipelining/Yjava-tasty-from-tasty/project/DottyInjectedPlugin.scala b/sbt-test/pipelining/Xjava-tasty-from-tasty/project/DottyInjectedPlugin.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-from-tasty/project/DottyInjectedPlugin.scala rename to sbt-test/pipelining/Xjava-tasty-from-tasty/project/DottyInjectedPlugin.scala diff --git a/sbt-test/pipelining/Yjava-tasty-from-tasty/test b/sbt-test/pipelining/Xjava-tasty-from-tasty/test similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-from-tasty/test rename to sbt-test/pipelining/Xjava-tasty-from-tasty/test diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/a-check/.keep b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/a-check/.keep similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/a-check/.keep rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/a-check/.keep diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/a/src/main/scala/a/A.java b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/a/src/main/scala/a/A.java similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/a/src/main/scala/a/A.java rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/a/src/main/scala/a/A.java diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/a/src/main/scala/a/AImport.java b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/a/src/main/scala/a/AImport.java similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/a/src/main/scala/a/AImport.java rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/a/src/main/scala/a/AImport.java diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/a/src/main/scala/a/package.scala b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/a/src/main/scala/a/package.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/a/src/main/scala/a/package.scala rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/a/src/main/scala/a/package.scala diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/b-alt/.keep b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/b-alt/.keep similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/b-alt/.keep rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/b-alt/.keep diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/b/src/main/scala/b/B.scala b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/b/src/main/scala/b/B.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/b/src/main/scala/b/B.scala rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/b/src/main/scala/b/B.scala diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/b/src/main/scala/b/BImport.scala b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/b/src/main/scala/b/BImport.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/b/src/main/scala/b/BImport.scala rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/b/src/main/scala/b/BImport.scala diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/build.sbt b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/build.sbt similarity index 91% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/build.sbt rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/build.sbt index 9013490f1f54..c51a266c2ee9 100644 --- a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/build.sbt +++ b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/build.sbt @@ -1,8 +1,8 @@ lazy val a = project.in(file("a")) .settings( compileOrder := CompileOrder.Mixed, // ensure we send java sources to Scala compiler - scalacOptions += "-Yjava-tasty", // enable pickling of java signatures - scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty.jar").toString), + scalacOptions += "-Xjava-tasty", // enable pickling of java signatures + scalacOptions ++= Seq("-Xearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty.jar").toString), scalacOptions += "-Ycheck:all", Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a-enum-classes"), // send classfiles to a different directory ) @@ -13,8 +13,8 @@ lazy val aCheck = project.in(file("a-check")) scalacOptions += "-Ytest-pickler", // check that the pickler is correct Compile / sources := (a / Compile / sources).value, // use the same sources as a compileOrder := CompileOrder.Mixed, // ensure we send java sources to Scala compiler - scalacOptions += "-Yjava-tasty", // enable pickling of java signatures - scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty-2.jar").toString), + scalacOptions += "-Xjava-tasty", // enable pickling of java signatures + scalacOptions ++= Seq("-Xearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-enum-java-tasty-2.jar").toString), Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a-enum-classes-2"), // send classfiles to a different directory ) diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/c-alt/.keep b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/c-alt/.keep similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/c-alt/.keep rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/c-alt/.keep diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/c/src/main/scala/c/C.scala b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/c/src/main/scala/c/C.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/c/src/main/scala/c/C.scala rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/c/src/main/scala/c/C.scala diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/c/src/main/scala/c/CImport.scala b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/c/src/main/scala/c/CImport.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/c/src/main/scala/c/CImport.scala rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/c/src/main/scala/c/CImport.scala diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/project/DottyInjectedPlugin.scala b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/project/DottyInjectedPlugin.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/project/DottyInjectedPlugin.scala rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/project/DottyInjectedPlugin.scala diff --git a/sbt-test/pipelining/Yjava-tasty-fromjavaobject/test b/sbt-test/pipelining/Xjava-tasty-fromjavaobject/test similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-fromjavaobject/test rename to sbt-test/pipelining/Xjava-tasty-fromjavaobject/test diff --git a/sbt-test/pipelining/Yjava-tasty-generic/a/src/main/scala/a/A.java b/sbt-test/pipelining/Xjava-tasty-generic/a/src/main/scala/a/A.java similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-generic/a/src/main/scala/a/A.java rename to sbt-test/pipelining/Xjava-tasty-generic/a/src/main/scala/a/A.java diff --git a/sbt-test/pipelining/Yjava-tasty-generic/a/src/main/scala/a/package.scala b/sbt-test/pipelining/Xjava-tasty-generic/a/src/main/scala/a/package.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-generic/a/src/main/scala/a/package.scala rename to sbt-test/pipelining/Xjava-tasty-generic/a/src/main/scala/a/package.scala diff --git a/sbt-test/pipelining/Yjava-tasty-generic/b-alt/.keep b/sbt-test/pipelining/Xjava-tasty-generic/b-alt/.keep similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-generic/b-alt/.keep rename to sbt-test/pipelining/Xjava-tasty-generic/b-alt/.keep diff --git a/sbt-test/pipelining/Yjava-tasty-generic/b/src/main/scala/b/B.scala b/sbt-test/pipelining/Xjava-tasty-generic/b/src/main/scala/b/B.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-generic/b/src/main/scala/b/B.scala rename to sbt-test/pipelining/Xjava-tasty-generic/b/src/main/scala/b/B.scala diff --git a/sbt-test/pipelining/Yjava-tasty-generic/build.sbt b/sbt-test/pipelining/Xjava-tasty-generic/build.sbt similarity index 91% rename from sbt-test/pipelining/Yjava-tasty-generic/build.sbt rename to sbt-test/pipelining/Xjava-tasty-generic/build.sbt index 9e2796600333..c043d597c6cc 100644 --- a/sbt-test/pipelining/Yjava-tasty-generic/build.sbt +++ b/sbt-test/pipelining/Xjava-tasty-generic/build.sbt @@ -1,7 +1,7 @@ lazy val a = project.in(file("a")) .settings( - scalacOptions += "-Yjava-tasty", // enable pickling of java signatures - scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-generic-java-tasty.jar").toString), + scalacOptions += "-Xjava-tasty", // enable pickling of java signatures + scalacOptions ++= Seq("-Xearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-generic-java-tasty.jar").toString), scalacOptions += "-Ycheck:all", Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a-generic-classes"), // send classfiles to a different directory ) diff --git a/sbt-test/pipelining/Yjava-tasty-generic/project/DottyInjectedPlugin.scala b/sbt-test/pipelining/Xjava-tasty-generic/project/DottyInjectedPlugin.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-generic/project/DottyInjectedPlugin.scala rename to sbt-test/pipelining/Xjava-tasty-generic/project/DottyInjectedPlugin.scala diff --git a/sbt-test/pipelining/Yjava-tasty-generic/test b/sbt-test/pipelining/Xjava-tasty-generic/test similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-generic/test rename to sbt-test/pipelining/Xjava-tasty-generic/test diff --git a/sbt-test/pipelining/Yjava-tasty-paths/a/InnerClass.java b/sbt-test/pipelining/Xjava-tasty-paths/a/InnerClass.java similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-paths/a/InnerClass.java rename to sbt-test/pipelining/Xjava-tasty-paths/a/InnerClass.java diff --git a/sbt-test/pipelining/Yjava-tasty-paths/a/InnerClassGen.java b/sbt-test/pipelining/Xjava-tasty-paths/a/InnerClassGen.java similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-paths/a/InnerClassGen.java rename to sbt-test/pipelining/Xjava-tasty-paths/a/InnerClassGen.java diff --git a/sbt-test/pipelining/Yjava-tasty-paths/a/InnerClassSub.java b/sbt-test/pipelining/Xjava-tasty-paths/a/InnerClassSub.java similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-paths/a/InnerClassSub.java rename to sbt-test/pipelining/Xjava-tasty-paths/a/InnerClassSub.java diff --git a/sbt-test/pipelining/Yjava-tasty-paths/a/RawTypes.java b/sbt-test/pipelining/Xjava-tasty-paths/a/RawTypes.java similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-paths/a/RawTypes.java rename to sbt-test/pipelining/Xjava-tasty-paths/a/RawTypes.java diff --git a/sbt-test/pipelining/Yjava-tasty-paths/a/package.scala b/sbt-test/pipelining/Xjava-tasty-paths/a/package.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-paths/a/package.scala rename to sbt-test/pipelining/Xjava-tasty-paths/a/package.scala diff --git a/sbt-test/pipelining/Yjava-tasty-paths/b/Test.scala b/sbt-test/pipelining/Xjava-tasty-paths/b/Test.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-paths/b/Test.scala rename to sbt-test/pipelining/Xjava-tasty-paths/b/Test.scala diff --git a/sbt-test/pipelining/Yjava-tasty-paths/build.sbt b/sbt-test/pipelining/Xjava-tasty-paths/build.sbt similarity index 92% rename from sbt-test/pipelining/Yjava-tasty-paths/build.sbt rename to sbt-test/pipelining/Xjava-tasty-paths/build.sbt index 49487fccb57e..24a6f582647f 100644 --- a/sbt-test/pipelining/Yjava-tasty-paths/build.sbt +++ b/sbt-test/pipelining/Xjava-tasty-paths/build.sbt @@ -1,7 +1,7 @@ lazy val a = project.in(file("a")) .settings( - scalacOptions += "-Yjava-tasty", // enable pickling of java signatures - scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-paths-java-tasty.jar").toString), + scalacOptions += "-Xjava-tasty", // enable pickling of java signatures + scalacOptions ++= Seq("-Xearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-paths-java-tasty.jar").toString), scalacOptions += "-Ycheck:all", Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a-paths-classes"), // send classfiles to a different directory ) diff --git a/sbt-test/pipelining/Yjava-tasty-paths/project/DottyInjectedPlugin.scala b/sbt-test/pipelining/Xjava-tasty-paths/project/DottyInjectedPlugin.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-paths/project/DottyInjectedPlugin.scala rename to sbt-test/pipelining/Xjava-tasty-paths/project/DottyInjectedPlugin.scala diff --git a/sbt-test/pipelining/Yjava-tasty-paths/test b/sbt-test/pipelining/Xjava-tasty-paths/test similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-paths/test rename to sbt-test/pipelining/Xjava-tasty-paths/test diff --git a/sbt-test/pipelining/Yjava-tasty-result-types/a/src/main/scala/a/A.java b/sbt-test/pipelining/Xjava-tasty-result-types/a/src/main/scala/a/A.java similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-result-types/a/src/main/scala/a/A.java rename to sbt-test/pipelining/Xjava-tasty-result-types/a/src/main/scala/a/A.java diff --git a/sbt-test/pipelining/Yjava-tasty-result-types/a/src/main/scala/a/package.scala b/sbt-test/pipelining/Xjava-tasty-result-types/a/src/main/scala/a/package.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-result-types/a/src/main/scala/a/package.scala rename to sbt-test/pipelining/Xjava-tasty-result-types/a/src/main/scala/a/package.scala diff --git a/sbt-test/pipelining/Yjava-tasty-result-types/b-alt/.keep b/sbt-test/pipelining/Xjava-tasty-result-types/b-alt/.keep similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-result-types/b-alt/.keep rename to sbt-test/pipelining/Xjava-tasty-result-types/b-alt/.keep diff --git a/sbt-test/pipelining/Yjava-tasty-result-types/b/src/main/scala/b/B.scala b/sbt-test/pipelining/Xjava-tasty-result-types/b/src/main/scala/b/B.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-result-types/b/src/main/scala/b/B.scala rename to sbt-test/pipelining/Xjava-tasty-result-types/b/src/main/scala/b/B.scala diff --git a/sbt-test/pipelining/Yjava-tasty-result-types/build.sbt b/sbt-test/pipelining/Xjava-tasty-result-types/build.sbt similarity index 92% rename from sbt-test/pipelining/Yjava-tasty-result-types/build.sbt rename to sbt-test/pipelining/Xjava-tasty-result-types/build.sbt index 80bcf71b3365..f540de2d6599 100644 --- a/sbt-test/pipelining/Yjava-tasty-result-types/build.sbt +++ b/sbt-test/pipelining/Xjava-tasty-result-types/build.sbt @@ -1,7 +1,7 @@ lazy val a = project.in(file("a")) .settings( - scalacOptions += "-Yjava-tasty", // enable pickling of java signatures - scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-result-types-java-tasty.jar").toString), + scalacOptions += "-Xjava-tasty", // enable pickling of java signatures + scalacOptions ++= Seq("-Xearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-result-types-java-tasty.jar").toString), scalacOptions += "-Ycheck:all", Compile / classDirectory := ((ThisBuild / baseDirectory).value / "a-result-types-classes"), // send classfiles to a different directory ) diff --git a/sbt-test/pipelining/Yjava-tasty-result-types/project/DottyInjectedPlugin.scala b/sbt-test/pipelining/Xjava-tasty-result-types/project/DottyInjectedPlugin.scala similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-result-types/project/DottyInjectedPlugin.scala rename to sbt-test/pipelining/Xjava-tasty-result-types/project/DottyInjectedPlugin.scala diff --git a/sbt-test/pipelining/Yjava-tasty-result-types/test b/sbt-test/pipelining/Xjava-tasty-result-types/test similarity index 100% rename from sbt-test/pipelining/Yjava-tasty-result-types/test rename to sbt-test/pipelining/Xjava-tasty-result-types/test diff --git a/sbt-test/pipelining/pipelining-test/test b/sbt-test/pipelining/pipelining-test/test index e2b8e39082b2..1c996d6962e8 100644 --- a/sbt-test/pipelining/pipelining-test/test +++ b/sbt-test/pipelining/pipelining-test/test @@ -1,12 +1,12 @@ # run the tests on a project with pipelining -# exercises the fact that -Ypickle-java and -Ypickle-write +# exercises the fact that -Xjava-tasty and -Xpickle-write # flags are set twice. # steps: -# - Compile scope is compiled with flags `-Ypickle-java -Ypickle-write early/a-early-7423784.jar` +# - Compile scope is compiled with flags `-Xjava-tasty -Xpickle-write early/a-early-7423784.jar` # - sbt copies `early/a-early-7423784.jar` to `early/a-early.jar` -# - Test scope is compiled with flags `-Ypickle-java -Ypickle-write early-test/a-early-963232.jar -Ypickle-java -Ypickle-write early/a-early.jar -classpath early/a-early.jar` +# - Test scope is compiled with flags `-Xjava-tasty -Xpickle-write early-test/a-early-963232.jar -Xjava-tasty -Xpickle-write early/a-early.jar -classpath early/a-early.jar` # e.g. for some reason the classpath has the same `a-early.jar` that -# is passed with `Ypickle-write`. -# Therefore we MUST avoid even reading the second `-Ypickle-write` setting, +# is passed with `Xpickle-write`. +# Therefore we MUST avoid even reading the second `-Xpickle-write` setting, # otherwise we will zero-out `a-early.jar`, causing type errors because its contents are blank. > a/test diff --git a/scaladoc/src/dotty/tools/scaladoc/snippets/SnippetCompiler.scala b/scaladoc/src/dotty/tools/scaladoc/snippets/SnippetCompiler.scala index 2d8ca15d9c4f..1648dbe2917b 100644 --- a/scaladoc/src/dotty/tools/scaladoc/snippets/SnippetCompiler.scala +++ b/scaladoc/src/dotty/tools/scaladoc/snippets/SnippetCompiler.scala @@ -29,8 +29,8 @@ class SnippetCompiler( val rootCtx = initCtx.fresh.addMode(Mode.ReadPositions).addMode(Mode.Interactive) rootCtx.setSetting(rootCtx.settings.experimental, true) rootCtx.setSetting(rootCtx.settings.YretainTrees, true) - rootCtx.setSetting(rootCtx.settings.YcookComments, true) - rootCtx.setSetting(rootCtx.settings.YreadComments, true) + rootCtx.setSetting(rootCtx.settings.XcookComments, true) + rootCtx.setSetting(rootCtx.settings.XreadComments, true) rootCtx.setSetting(rootCtx.settings.color, "never") rootCtx.setSetting(rootCtx.settings.XimportSuggestionTimeout, 0) diff --git a/scaladoc/src/scala/tasty/inspector/TastyInspector.scala b/scaladoc/src/scala/tasty/inspector/TastyInspector.scala index 03b3aadedc4d..906578c9d405 100644 --- a/scaladoc/src/scala/tasty/inspector/TastyInspector.scala +++ b/scaladoc/src/scala/tasty/inspector/TastyInspector.scala @@ -103,7 +103,7 @@ object TastyInspector: reset() val ctx2 = ctx.fresh .addMode(Mode.ReadPositions) - .setSetting(ctx.settings.YreadComments, true) + .setSetting(ctx.settings.XreadComments, true) new TASTYRun(this, ctx2) new InspectorDriver diff --git a/staging/src/scala/quoted/staging/QuoteDriver.scala b/staging/src/scala/quoted/staging/QuoteDriver.scala index 7eb99bce4ff8..0131a56cd8aa 100644 --- a/staging/src/scala/quoted/staging/QuoteDriver.scala +++ b/staging/src/scala/quoted/staging/QuoteDriver.scala @@ -41,7 +41,7 @@ private class QuoteDriver(appClassloader: ClassLoader) extends Driver: setCompilerSettings(ctx1.fresh.setSetting(ctx1.settings.outputDir, outDir), settings) } - val compiledExpr = + val compiledExpr = try new QuoteCompiler().newRun(ctx).compileExpr(exprBuilder) catch case ex: dotty.tools.FatalError => @@ -50,10 +50,10 @@ private class QuoteDriver(appClassloader: ClassLoader) extends Driver: |This might be caused by using an incorrect classloader |when creating the `staging.Compiler` instance with `staging.Compiler.make`. |For details, please refer to the documentation. - |For non-enriched exceptions, compile with -Yno-enrich-error-messages.""".stripMargin - if ctx.settings.YnoEnrichErrorMessages.value(using ctx) then throw ex + |For non-enriched exceptions, compile with -Xno-enrich-error-messages.""".stripMargin + if ctx.settings.XnoEnrichErrorMessages.value(using ctx) then throw ex else throw new Exception(enrichedMessage, ex) - + compiledExpr match case Right(value) => value.asInstanceOf[T] diff --git a/tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala b/tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala index ea3f0a95dded..7c5476d35940 100644 --- a/tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala +++ b/tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala @@ -100,7 +100,7 @@ object TastyInspector: reset() val ctx2 = ctx.fresh .addMode(Mode.ReadPositions) - .setSetting(ctx.settings.YreadComments, true) + .setSetting(ctx.settings.XreadComments, true) new TASTYRun(this, ctx2) new InspectorDriver diff --git a/tests/explicit-nulls/pos/i14682.scala b/tests/explicit-nulls/pos/i14682.scala index 318de6094a88..76ae621a406e 100644 --- a/tests/explicit-nulls/pos/i14682.scala +++ b/tests/explicit-nulls/pos/i14682.scala @@ -1,4 +1,4 @@ -//> using options -Ysafe-init +//> using options -Wsafe-init class C1: sealed abstract class Name { @@ -26,4 +26,4 @@ class C2: val localName = LocalName() println(localName) - var count = 0 \ No newline at end of file + var count = 0 diff --git a/tests/neg/i16438.scala b/tests/neg/i16438.scala index a2b88080c2cd..793e6518ea71 100644 --- a/tests/neg/i16438.scala +++ b/tests/neg/i16438.scala @@ -1,4 +1,4 @@ -//> using options -Ysafe-init +//> using options -Wsafe-init trait ATrait(val string: String, val int: Int) trait AnotherTrait( override val string: String, override val int: Int) extends ATrait case class ACaseClass(override val string: String) extends AnotherTrait(string, 3) // error diff --git a/tests/neg/i2887b.check b/tests/neg/i2887b.check index 7b85d1a0223b..5bd5f570fbf7 100644 --- a/tests/neg/i2887b.check +++ b/tests/neg/i2887b.check @@ -4,7 +4,7 @@ | Recursion limit exceeded. | Maybe there is an illegal cyclic reference? | If that's not the case, you could also try to increase the stacksize using the -Xss JVM option. - | For the unprocessed stack trace, compile with -Yno-decode-stacktraces. + | For the unprocessed stack trace, compile with -Xno-decode-stacktraces. | A recurring operation is (inner to outer): | | try to instantiate Z[Z] diff --git a/tests/neg/kind-projector-underscores.scala b/tests/neg/kind-projector-underscores.scala index 76aada871fae..e2cdee917e81 100644 --- a/tests/neg/kind-projector-underscores.scala +++ b/tests/neg/kind-projector-underscores.scala @@ -1,4 +1,4 @@ -//> using options -Ykind-projector:underscores +//> using options -Xkind-projector:underscores package kind_projector_neg diff --git a/tests/neg/kind-projector.scala b/tests/neg/kind-projector.scala index a7fc24c70b93..a03dd83a1945 100644 --- a/tests/neg/kind-projector.scala +++ b/tests/neg/kind-projector.scala @@ -1,4 +1,4 @@ -//> using options -Ykind-projector +//> using options -Xkind-projector package kind_projector_neg diff --git a/tests/pos/i16777.scala b/tests/pos/i16777.scala index 302ace3ea9aa..4b7399ac053c 100644 --- a/tests/pos/i16777.scala +++ b/tests/pos/i16777.scala @@ -1,4 +1,4 @@ -//> using options -Ykind-projector:underscores +//> using options -Xkind-projector:underscores sealed abstract class Free[+S[_, _], +E, +A] { @inline final def flatMap[S1[e, a] >: S[e, a], B, E1 >: E](fun: A => Free[S1, E1, B]): Free[S1, E1, B] = Free.FlatMapped[S1, E, E1, A, B](this, fun) diff --git a/tests/pos/i19806/Module.scala b/tests/pos/i19806/Module.scala index d0142fc24682..328dcd213d2e 100644 --- a/tests/pos/i19806/Module.scala +++ b/tests/pos/i19806/Module.scala @@ -1,4 +1,4 @@ -//> using options -Yjava-tasty -Ytest-pickler-check +//> using options -Xjava-tasty -Ytest-pickler-check package p diff --git a/tests/pos/kind-projector-underscores.scala b/tests/pos/kind-projector-underscores.scala index f72a300a64eb..6f4349a8ec7c 100644 --- a/tests/pos/kind-projector-underscores.scala +++ b/tests/pos/kind-projector-underscores.scala @@ -1,4 +1,4 @@ -//> using options -Ykind-projector:underscores +//> using options -Xkind-projector:underscores package kind_projector diff --git a/tests/pos/kind-projector.scala b/tests/pos/kind-projector.scala index 4d6ec8c932a9..7e4a2c7f5c1b 100644 --- a/tests/pos/kind-projector.scala +++ b/tests/pos/kind-projector.scala @@ -1,4 +1,4 @@ -//> using options -Ykind-projector +//> using options -Xkind-projector package kind_projector diff --git a/tests/run-macros/i12351/Test_2.scala b/tests/run-macros/i12351/Test_2.scala index e480b3c7e86e..a48d30772d5c 100644 --- a/tests/run-macros/i12351/Test_2.scala +++ b/tests/run-macros/i12351/Test_2.scala @@ -1,4 +1,4 @@ -//> using options -Yread-docs +//> using options -Xread-docs @main def Test(): Unit = { println(getDocString[Data]) diff --git a/tests/run-macros/i12352/Main.scala b/tests/run-macros/i12352/Main.scala index b62bd80eaf2c..19cdf2a82d3b 100644 --- a/tests/run-macros/i12352/Main.scala +++ b/tests/run-macros/i12352/Main.scala @@ -1,4 +1,4 @@ -//> using options -Yread-docs +//> using options -Xread-docs @main def Test(): Unit = { val res = getDocString[scala.quoted.Quotes] diff --git a/tests/untried/neg/choices.check b/tests/untried/neg/choices.check index b114394e9609..2e45461ca178 100644 --- a/tests/untried/neg/choices.check +++ b/tests/untried/neg/choices.check @@ -1,2 +1,2 @@ -error: bad options: -Yresolve-term-conflict +error: bad options: -Xresolve-term-conflict one error found diff --git a/tests/untried/neg/choices.flags b/tests/untried/neg/choices.flags index 9718467d4ca2..7a04890a6dee 100644 --- a/tests/untried/neg/choices.flags +++ b/tests/untried/neg/choices.flags @@ -1 +1 @@ --Yresolve-term-conflict +-Xresolve-term-conflict