Skip to content

Commit

Permalink
Merge pull request #354 from insdami/rename-cfg-explicit-return-type
Browse files Browse the repository at this point in the history
Renamed configuration explicitReturnTypes to explicitResultTypes
  • Loading branch information
olafurpg authored Sep 17, 2017
2 parents 06edc24 + e5216b6 commit ea7eeb8
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion readme/ImplementingRules.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down
8 changes: 4 additions & 4 deletions readme/Rules.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
rules = ExplicitResultTypes
*/
package test.explicitReturnTypes
package test.explicitResultTypes

object ExplicitResultTypesPathDependent {
class Path {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
rules = ExplicitResultTypes
explicitReturnTypes.unsafeShortenNames = true
ExplicitResultTypes.unsafeShortenNames = true
*/
package test.explicitReturnTypes
package test.explicitResultTypes

import scala.language.implicitConversions

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
rules = ExplicitResultTypes
*/
package test.explicitReturnTypes
package test.explicitResultTypes

object ExplicitResultTypesSingleton {
implicit val default = ExplicitResultTypesSingleton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package test.explicitReturnTypes
package test.explicitResultTypes

import scala.language.implicitConversions

Expand Down Expand Up @@ -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 = `->`
}
}

Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package test.explicitReturnTypes
package test.explicitResultTypes

import scala.language.implicitConversions

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit ea7eeb8

Please sign in to comment.