All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fix.ReplaceSymbolLiterals.scala Maven / Gradle / Ivy

The newest version!
package fix

import scala.meta.Lit
import scala.meta.XtensionCollectionLikeUI
import scalafix.v1.Patch
import scalafix.v1.SyntacticDocument
import scalafix.v1.SyntacticRule

class ReplaceSymbolLiterals extends SyntacticRule("ReplaceSymbolLiterals") {

  override def fix(implicit doc: SyntacticDocument): Patch = {
    doc.tree.collect { case literal @ Lit.Symbol(_) =>
      Patch.replaceTree(literal, s"""Symbol("${literal.value.name}")""")
    }.foldLeft(Patch.empty)(_ + _)
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy