Skip to content

Commit c958340

Browse files
committed
Address feedback
1 parent cab6275 commit c958340

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

blog/_posts/2017-02-23-scalafix-v0.3.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ We are happy to announce the release of [scalafix v0.3][scalafix].
44
This release introduces a new `Rewrite` and `Patch` API powered by the [scala.meta semantic API][meta-1.6].
55
We are excited about this release because we believe it enables a number promising tooling applications.
66

7-
This first release of the scala.meta semantic API enables rewrites to query for the "symbol" of a name that appears in a Scala source file.
7+
Scala.meta recently had its first release of its semantic API; the semantic API provides operations to query information from the compiler.
8+
This has enabled rewrites in scalafix to query for the so-called "symbol" of a name that appears in a Scala source file.
89
A symbol is a unique identifier of a definition such as a class, val, def or trait.
910
This ability to query for symbols opens possibilities for a great number of refactorings including imports management and identifier renaming.
10-
To demonstrate what rewrites can be implemented with scalafix v0.3, let's take one example.
11+
12+
The long-term mission of scalafix is to help automate the migration of deprecated Scala 2.x features to Dotty.
13+
However, scalafix can be used for more than migrating between Scala versions; it can also be used for ad-hoc library and application migrations.
14+
To demonstrate what rewrites can be implemented with scalafix v0.3, let's step through an example of a real usecase.
1115

1216
## Example: Xor to Either
1317

@@ -30,7 +34,10 @@ Replace(Symbol("_root_.cats.data.Xor.Left."), q"Left")
3034
Replace(Symbol("_root_.cats.data.Xor.Right."), q"Right")
3135
```
3236

33-
To introduce new imports on renmae, it's possible to pass in `additionalImports`
37+
The `Symbol(_root_...data.Xor)` part is the scala.meta symbol referencing the class definition of `cats.data.Xor`.
38+
As we saw in the `either: Xor[HCursor` diff above, references to `Xor` should become `Either` after the rewrite.
39+
40+
To introduce new imports on rename, it's possible to pass in `additionalImports`
3441
```scala
3542
Replace(Symbol("_root_.cats.data.XorT."), q"EitherT",
3643
additionalImports = List(importer"cats.data.EitherT")),

0 commit comments

Comments
 (0)