diff --git a/readme/ImplementingRules.scalatex b/readme/ImplementingRules.scalatex index 9e5c36d37..c2fc84b73 100644 --- a/readme/ImplementingRules.scalatex +++ b/readme/ImplementingRules.scalatex @@ -123,7 +123,7 @@ To run a rule, users execute @code{scalafix --rules MyRule}. Multiple rules can be composed into a single rule. For example, the migration for Dotty may involve @sect.ref{ProcedureSyntax}, - @sect.ref{ExplicitUnit}, @sect.ref{DottyVarArgPattern}, @sect.ref{ExplicitReturnTypes} + @sect.ref{ExplicitUnit}, @sect.ref{DottyVarArgPattern}, @sect.ref{ExplicitResultTypes} and a few other rules. It is possible to combine all of those rules into a single @code{Dotty} rule so users can run @code{scalafix --rules Dotty}. diff --git a/readme/Rules.scalatex b/readme/Rules.scalatex index 9dfe8eb15..187650650 100644 --- a/readme/Rules.scalatex +++ b/readme/Rules.scalatex @@ -29,12 +29,12 @@ @h3{Configuration} @config - explicitReturnTypes.memberKind = [Val, Def, Var] - explicitReturnTypes.memberVisibility = [Public, Protected] + ExplicitResultTypes.memberKind = [Val, Def, Var] + ExplicitResultTypes.memberVisibility = [Public, Protected] // Experimental, shorten fully qualified names and insert missing imports // By default, names are fully qualified and prefixed with _root_. unsafeShortenNames = true // false by default. - explicitReturnTypes.unsafeShortenNames = true // false by default. + ExplicitResultTypes.unsafeShortenNames = true // false by default. @h3{Known limitations} @@ -52,7 +52,7 @@ true with @code{unsafeShortenNames=true}, but may happen by default for path dependent types. - @sect{ExplicitReturnTypes} + @sect{ExplicitResultTypes} This rule has been renamed into @sect.ref{ExplicitResultTypes} @sect(RemoveUnusedImports.toString) diff --git a/scalafix-core/shared/src/main/scala/scalafix/internal/rule/ExplicitResultTypes.scala b/scalafix-core/shared/src/main/scala/scalafix/internal/rule/ExplicitResultTypes.scala index efc946cdd..3662dd84b 100644 --- a/scalafix-core/shared/src/main/scala/scalafix/internal/rule/ExplicitResultTypes.scala +++ b/scalafix-core/shared/src/main/scala/scalafix/internal/rule/ExplicitResultTypes.scala @@ -32,8 +32,9 @@ case class ExplicitResultTypes( def this(index: SemanticdbIndex) = this(index, ExplicitResultTypesConfig.default) override def init(config: Conf): Configured[Rule] = - config - .getOrElse("explicitReturnTypes")(ExplicitResultTypesConfig.default) + config // Support deprecated explicitReturnTypes config + .getOrElse("explicitReturnTypes", "ExplicitResultTypes")( + ExplicitResultTypesConfig.default) .map(c => ExplicitResultTypes(index, c)) // Don't explicitly annotate vals when the right-hand body is a single call diff --git a/scalafix-tests/input/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesBase.scala b/scalafix-tests/input/src/main/scala/test/explicitResultTypes/ExplicitResultTypesBase.scala similarity index 90% rename from scalafix-tests/input/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesBase.scala rename to scalafix-tests/input/src/main/scala/test/explicitResultTypes/ExplicitResultTypesBase.scala index f9b78b45b..6065a7764 100644 --- a/scalafix-tests/input/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesBase.scala +++ b/scalafix-tests/input/src/main/scala/test/explicitResultTypes/ExplicitResultTypesBase.scala @@ -1,9 +1,9 @@ /* rules = ExplicitResultTypes -explicitReturnTypes.memberKind = [Val, Def, Var] -explicitReturnTypes.memberVisibility = [Public, Protected] +ExplicitResultTypes.memberKind = [Val, Def, Var] +ExplicitResultTypes.memberVisibility = [Public, Protected] */ -package test.explicitReturnTypes +package test.explicitResultTypes import scala.language.implicitConversions diff --git a/scalafix-tests/input/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesPathDependent.scala b/scalafix-tests/input/src/main/scala/test/explicitResultTypes/ExplicitResultTypesPathDependent.scala similarity index 88% rename from scalafix-tests/input/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesPathDependent.scala rename to scalafix-tests/input/src/main/scala/test/explicitResultTypes/ExplicitResultTypesPathDependent.scala index 682d521a2..197b00488 100644 --- a/scalafix-tests/input/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesPathDependent.scala +++ b/scalafix-tests/input/src/main/scala/test/explicitResultTypes/ExplicitResultTypesPathDependent.scala @@ -1,7 +1,7 @@ /* rules = ExplicitResultTypes */ -package test.explicitReturnTypes +package test.explicitResultTypes object ExplicitResultTypesPathDependent { class Path { diff --git a/scalafix-tests/input/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesShort.scala b/scalafix-tests/input/src/main/scala/test/explicitResultTypes/ExplicitResultTypesShort.scala similarity index 87% rename from scalafix-tests/input/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesShort.scala rename to scalafix-tests/input/src/main/scala/test/explicitResultTypes/ExplicitResultTypesShort.scala index 4f4a15c3a..f33726598 100644 --- a/scalafix-tests/input/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesShort.scala +++ b/scalafix-tests/input/src/main/scala/test/explicitResultTypes/ExplicitResultTypesShort.scala @@ -1,8 +1,8 @@ /* rules = ExplicitResultTypes -explicitReturnTypes.unsafeShortenNames = true +ExplicitResultTypes.unsafeShortenNames = true */ -package test.explicitReturnTypes +package test.explicitResultTypes import scala.language.implicitConversions diff --git a/scalafix-tests/input/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesSingleton.scala b/scalafix-tests/input/src/main/scala/test/explicitResultTypes/ExplicitResultTypesSingleton.scala similarity index 88% rename from scalafix-tests/input/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesSingleton.scala rename to scalafix-tests/input/src/main/scala/test/explicitResultTypes/ExplicitResultTypesSingleton.scala index a295cb56f..18d4d8d55 100644 --- a/scalafix-tests/input/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesSingleton.scala +++ b/scalafix-tests/input/src/main/scala/test/explicitResultTypes/ExplicitResultTypesSingleton.scala @@ -1,7 +1,7 @@ /* rules = ExplicitResultTypes */ -package test.explicitReturnTypes +package test.explicitResultTypes object ExplicitResultTypesSingleton { implicit val default = ExplicitResultTypesSingleton diff --git a/scalafix-tests/output/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesBase.scala b/scalafix-tests/output/src/main/scala/test/explicitResultTypes/ExplicitResultTypesBase.scala similarity index 95% rename from scalafix-tests/output/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesBase.scala rename to scalafix-tests/output/src/main/scala/test/explicitResultTypes/ExplicitResultTypesBase.scala index 42604e5f9..855c9d737 100644 --- a/scalafix-tests/output/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesBase.scala +++ b/scalafix-tests/output/src/main/scala/test/explicitResultTypes/ExplicitResultTypesBase.scala @@ -1,4 +1,4 @@ -package test.explicitReturnTypes +package test.explicitResultTypes import scala.language.implicitConversions @@ -44,7 +44,7 @@ object ExplicitResultTypesBase { object `->` { def unapply[S](in: (S, S)): Option[(S, S)] = Some(in) } - val `→`: _root_.test.explicitReturnTypes.ExplicitResultTypesBase.unicode.->.type = `->` + val `→`: _root_.test.explicitResultTypes.ExplicitResultTypesBase.unicode.->.type = `->` } } diff --git a/scalafix-tests/output/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesPathDependent.scala b/scalafix-tests/output/src/main/scala/test/explicitResultTypes/ExplicitResultTypesPathDependent.scala similarity index 59% rename from scalafix-tests/output/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesPathDependent.scala rename to scalafix-tests/output/src/main/scala/test/explicitResultTypes/ExplicitResultTypesPathDependent.scala index be2cd3fa1..b016793a5 100644 --- a/scalafix-tests/output/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesPathDependent.scala +++ b/scalafix-tests/output/src/main/scala/test/explicitResultTypes/ExplicitResultTypesPathDependent.scala @@ -1,11 +1,11 @@ -package test.explicitReturnTypes +package test.explicitResultTypes object ExplicitResultTypesPathDependent { class Path { class B { class C } - implicit val x: _root_.test.explicitReturnTypes.ExplicitResultTypesPathDependent.Path#B = new B + implicit val x: _root_.test.explicitResultTypes.ExplicitResultTypesPathDependent.Path#B = new B implicit val y: x.C = new x.C def gimme(yy: x.C) = ???; gimme(y) } - implicit val b: _root_.test.explicitReturnTypes.ExplicitResultTypesPathDependent.Path#B = new Path().x + implicit val b: _root_.test.explicitResultTypes.ExplicitResultTypesPathDependent.Path#B = new Path().x } diff --git a/scalafix-tests/output/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesShort.scala b/scalafix-tests/output/src/main/scala/test/explicitResultTypes/ExplicitResultTypesShort.scala similarity index 95% rename from scalafix-tests/output/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesShort.scala rename to scalafix-tests/output/src/main/scala/test/explicitResultTypes/ExplicitResultTypesShort.scala index 4138a5228..d898da508 100644 --- a/scalafix-tests/output/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesShort.scala +++ b/scalafix-tests/output/src/main/scala/test/explicitResultTypes/ExplicitResultTypesShort.scala @@ -1,4 +1,4 @@ -package test.explicitReturnTypes +package test.explicitResultTypes import scala.language.implicitConversions diff --git a/scalafix-tests/output/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesSingleton.scala b/scalafix-tests/output/src/main/scala/test/explicitResultTypes/ExplicitResultTypesSingleton.scala similarity index 59% rename from scalafix-tests/output/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesSingleton.scala rename to scalafix-tests/output/src/main/scala/test/explicitResultTypes/ExplicitResultTypesSingleton.scala index 8b9aa54a9..9bb5c81ca 100644 --- a/scalafix-tests/output/src/main/scala/test/explicitReturnTypes/ExplicitResultTypesSingleton.scala +++ b/scalafix-tests/output/src/main/scala/test/explicitResultTypes/ExplicitResultTypesSingleton.scala @@ -1,8 +1,8 @@ -package test.explicitReturnTypes +package test.explicitResultTypes object ExplicitResultTypesSingleton { - implicit val default: _root_.test.explicitReturnTypes.ExplicitResultTypesSingleton.type = ExplicitResultTypesSingleton - implicit val singleton: _root_.test.explicitReturnTypes.ExplicitResultTypesSingleton2.Singleton.type = ExplicitResultTypesSingleton2.Singleton + implicit val default: _root_.test.explicitResultTypes.ExplicitResultTypesSingleton.type = ExplicitResultTypesSingleton + implicit val singleton: _root_.test.explicitResultTypes.ExplicitResultTypesSingleton2.Singleton.type = ExplicitResultTypesSingleton2.Singleton } object ExplicitResultTypesSingleton2 { object Singleton