Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read ExplicitResultTypes key instead of explicitReturnTypes #354

Merged
merged 2 commits into from
Sep 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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