From 73a882989ea49d51adb2665d31176cb5be56e5d0 Mon Sep 17 00:00:00 2001 From: Joan Goyeau Date: Sun, 1 Oct 2023 02:58:16 -0400 Subject: [PATCH] Add -Ysafe-init option --- .../org/typelevel/scalacoptions/ScalacOptions.scala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/src/main/scala/org/typelevel/scalacoptions/ScalacOptions.scala b/lib/src/main/scala/org/typelevel/scalacoptions/ScalacOptions.scala index 35bf29d..d569326 100644 --- a/lib/src/main/scala/org/typelevel/scalacoptions/ScalacOptions.scala +++ b/lib/src/main/scala/org/typelevel/scalacoptions/ScalacOptions.scala @@ -461,6 +461,12 @@ private[scalacoptions] trait ScalacOptions { val privateKindProjector = privateOption("kind-projector", version => version >= V3_0_0) + /** Enables safe initialization check. + * More info: [[https://docs.scala-lang.org/scala3/reference/other-new-features/safe-initialization.html]] + */ + val privateSafeInit = + privateOption("safe-init", version => version >= V3_0_0) + /** Enables support for higher order unification in type constructor inference. * * Initially provided as a compiler option in the 2.12.x series to fix the infamous @@ -469,10 +475,7 @@ private[scalacoptions] trait ScalacOptions { * Enabled by default in 2.13.0+ and no longer accepted by the compiler as an option. */ val privatePartialUnification = - privateOption( - "partial-unification", - version => version.isBetween(V2_11_11, V2_13_0) - ) + privateOption("partial-unification", version => version.isBetween(V2_11_11, V2_13_0)) /** Configures the number of worker threads for the compiler backend. * @@ -647,6 +650,7 @@ private[scalacoptions] trait ScalacOptions { val privateOptions: Set[ScalacOption] = ListSet( privateNoAdaptedArgs, privateKindProjector, + privateSafeInit, privatePartialUnification ) ++ privateWarnOptions